cvchjfjb
Re:Falsehoods programmers believe about undefined behavior
on Monday November 28, 2022 @08:19AM (#33773272)
That is a misconception.
"If any step in a program’s execution has undefined behavior, then the entire execution is without meaning. This is important: it’s not that evaluating (1<<32) has an unpredictable result, but rather that the entire execution of a program that evaluates this expression is meaningless. Also, it’s not that the execution is meaningful up to the point where undefined behavior happens: the bad effects can actually precede the undefined operation."
Re:Falsehoods programmers believe about undefined behavior
on Monday November 28, 2022 @07:40AM (#33772872)
No, no, no. UB is a global property of your program. "All bets are off" even at compile time.
"Anything at all can happen; the Standard imposes no requirements. The program may fail to compile, or it may execute incorrectly (either crashing or silently generating incorrect results), or it may fortuitously do exactly what the programmer intended."