Re:C and Undefined Behaviour
by AlotOfReading on Sunday February 08, 2026 @09:55PM
(#46941062)
That would be a much nicer definition of UB than is actually the case. What the standards say is that a program that writes to a null pointer (distinct from a zero pointer) is semantically meaningless. The compiler can assume the write doesn't happen at all, call some other functions first, initialize the pointer with a value it takes later, or whatever else it wants. One effect of this is so-called "time-traveling", where the entire execution trace before the point of UB in the execution trace is also semantically undefined. C23 updated to clarify that time travel isn't a valid interpretation, but it remains valid in C++.
[ Parent
| on HN ]
Re:C and Undefined Behaviour
by thezipcreator on Tuesday February 10, 2026 @04:26AM
(#46957256)
little did we know, to create a time machine all we needed to do was to compile some undefined behavior with the correct compiler