r/ProgrammingLanguages • • Dec 31 '25

Memory Safety Is ...

https://matklad.github.io/2025/12/30/memory-safety-is.html
38 Upvotes

78 comments sorted by

View all comments

Show parent comment

1

u/koflerdavid Jan 03 '26

GCC is fairly well-known to use undefined behaviors as an excuse to do optimization, to the annoyance of Linux kernel developers that expect it to behave more predictably. Both are not wrong: some behaviors are deliberately left undefined in the standards so compilers can exploit them for optimizations. At the same time, undefined behavior can be perfectly well-defined by the combination of compiler and platform, especially if it is documented, and one is justified to not like the associated brittleness. Maybe a solution is to define more compiler pragmas and intrinsics to control these things.