Re:Catch-23: The New C Standard Sets the World on Fire
by adgjlsfhk1 on Saturday April 01, 2023 @11:13PM
(#35406786)
> you have to be careful to test your code on different compiler settings.
The problem is you have to test your code on compilers that don't exist yet with compiler settings that do different things from any compiler that ever might exist.
Re:Catch-23: The New C Standard Sets the World on Fire
by coliveira on Saturday April 01, 2023 @11:55PM
(#35407022)
This has always been the case. If you write code that has UB, new compilers can do something yet undefined, by definition.
Re:Catch-23: The New C Standard Sets the World on Fire
by AlotOfReading on Saturday April 01, 2023 @11:35PM
(#35406916)
I'm not sure if you're making a point about "unspecified behavior" (where the compiler can choose between multiple valid behaviors), but no, a strictly conforming program will have the same semantics on different architectures. Strictly conforming programs can still have bugs, but their nature is completely different than UB because that's the point of the standard.
Not correct. Bugs can occur differently in different architectures, even in high level languages. UB is just a kind of bug whose effect depends on how the compiler behaves, so you have to be careful to test your code on different compiler settings. This is nothing new on programming languages, it is only made explicit in the C standard. Suddenly people started to believe that pointing out the obvious source of bugs (UB) in the standard is equivalent let programs misbehave.