r/ProgrammingLanguages • u/matklad • Dec 31 '25
Memory Safety Is ...
https://matklad.github.io/2025/12/30/memory-safety-is.html
37
Upvotes
r/ProgrammingLanguages • u/matklad • Dec 31 '25
View all comments
Show parent comment
1
u/sagittarius_ack Jan 03 '26
It really depends. From the point of view of the semantics of a programming language, the operation of dividing by 0 is undefined. In a language like C division by 0 is considered `undefined behavior`, which means that (from the point of view of the language) anything can happen.
Perhaps you could say that in practice "nothing ill-behaved happens" at the OS or hardware level. But a programing language doesn't typically say anything about what should happen at the OS or hardware level when, for example, a null pointer is dereferenced in a program. In fact, the C standard doesn't even say that the null pointer is the same as the address 0. This is from Wikipedia: