Re:Falsehoods programmers believe about undefined behavior
by sokoloff on Monday November 28, 2022 @07:33AM
(#33772807)
That is the observed behavior of the compiler not the defined behavior. (and while there’s some logical reason to assume that will likely continue to hold, the list is falsehoods programmers believe about undefined behavior, not observed behavior.)
[ Parent
| on HN ]
Re:Falsehoods programmers believe about undefined behavior
by victor82 on Monday November 28, 2022 @07:39AM
(#33772859)
"but it worked fine before" talks about the observed behavior
Re:Falsehoods programmers believe about undefined behavior
by sokoloff on Monday November 28, 2022 @07:41AM
(#33772880)
Yes. That is the sub-category of “among all the falsehoods about UB, these are the falsehoods that can be categorized as [improper reliance on] OB”.
Re:Falsehoods programmers believe about undefined behavior
by obi1kenobi on Monday November 28, 2022 @12:46PM
(#33776781)
(Post author here.) Agreed with the parent comment. To restate the same thing in another way in the hope of avoiding confusion:
It isn't a bug in the compiler if the compiler is non-deterministic in the presence of UB. Such behavior does not violate any guarantee provided by the compiler or language spec.
In fact, it's still not a bug if the compiler is non-deterministic, full stop. Many (most?) compilers have non-deterministic behavior due to a variety of factors. To get a sense of what's involved in getting determinism, look up some articles on why it's difficult to get reproducible builds working. It's a lot harder than it might seem at first.
Re:Falsehoods programmers believe about undefined behavior
by gpderetta on Tuesday November 29, 2022 @06:17AM
(#33786131)
Determinism is a QoI issue. It is an important QoI feature though and I think most compilers meant for production use at least strive to implement it. I guess things like parallel, distributed compilation make it quite hard.