http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47732

--- Comment #2 from Jan Koen Annot <J.K.Annot.at.Infor at gmail dot com> 
2011-02-15 14:21:16 UTC ---
(In reply to comment #1)
> And overflow is undefined in C/C++ so you are invoking undefined behavior 
> here.

Wow! This is an eye-opener for me! I am quite accustomed to assume two's
complement arithmetic with implicit wrap-around for signed integers.

After your remark I googled a bit and found several articles about undefined
behavior, e.g. John Regehr's "A Guide to Undefined Behavior in C and C++, Part
1".
Very instructive.

Reply via email to