Wouter Verhelst writes ("Re: Having fun with the following C code (UB)"):
> Yes; the standard does this to allow for machine architectures which do
> not use two's complement to store negative values. I did mention that
> assumption in my previous mail.
> 
> If the architecture uses two's complement, however, then the code is
> correct.

Unfortunately adversarial optimisation by modern compilers means that
this kind of reasoning is no longer valid.

The compiler might easily see that your code unconditionally performs
a computation with undefined behaviour, and delete it.

Ian.


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]
Archive: 
https://lists.debian.org/[email protected]

Reply via email to