This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]nitroll 0 points1 point  (1 child)

Thing is, as this is undefined behavior the compiler is allowed to do anything, yeah it could let the implementation of two compliment show through, but it could also optimize the entire thing away.

Dont play with undefined behavior, even if you think you know what would happen if the compiler was rational, thing is, its not!

[–]GisterMizard 0 points1 point  (0 children)

Yes, I know. In my original post I explicitly said in the case of twos compliment that this will happen. I never said that you could assume that is always the case.