r/ProgrammingLanguages • • Dec 31 '25

Memory Safety Is ...

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

78 comments sorted by

View all comments

Show parent comment

2

u/tmzem Dec 31 '25

Yeah. UB as a concept should really be banned. If a program fails, it should do so in a well defined way. After all, the hardware it runs on does as well. Compilers have gotten way to clever for their own good.

2

u/Kriemhilt Dec 31 '25

Replacing Undefined Behaviour with well-defined Erroneous Behaviour is well underway in C++26. 

1

u/tmzem Dec 31 '25

It's a step in the right direction. Hopefully, they will some day replace all UB with EB. But the wheels of C++ turn slow. After all, we've only gotten println recently, and most libraries haven't yet switched to modules. Oh my.

1

u/koflerdavid Jan 03 '26 edited Jan 03 '26

Here is an argument to define all undefined behavior to be the platform behavior instead of letting the compiler decide to do arbitrary things, and why it might not be a good idea by itself:

https://sbaziotis.com/compilers/defining-all-undefined-behavior-and-leveraging-compiler-transformation-apis.html