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 debian-devel-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/21318.32941.351261.72...@chiark.greenend.org.uk