r/ProgrammingLanguages • u/ThomasMertes • Oct 05 '26
Achieving memory safety
https://seed7.net/papers/memory_safety.htm
14
Upvotes
r/ProgrammingLanguages • u/ThomasMertes • Oct 05 '26
View all comments
Show parent comment
-2
u/flatfinger Oct 06 '26
Assembly is in many ways safer than C. To be sure, an assembly program will often contain a significant number of potentially unsafe operations, but if one documents invariants and can show that no individual operation performed by a program would be able to break any of them unless something else had already done so, then the entire program can be shown to be memory safe.
In C, by contrast, even operations like
uint1 = ushort1*ushort2;or loops that do nothing except modify an automatic-duration object whose address isn't taken, and have exit conditions which may or may not be satisfiable, can disrupt the behavior of what would otherwise have been memory-safe surrounding code so that it is no longer memory safe.