------- Comment #1 from pluto at agmk dot net  2006-04-22 08:23 -------
(In reply to comment #0)

>         int b = 0X80000000;

>         if ((b - 10) < 0)

b - 10 is 0xff(...)7ffffff6 and this is an integer overflow.

[ cite: c++ standard / $5.5 ]

if during the evaluation of an expression the result isn't mathematically
defined nor in the range of representable values for its type the behaviuor
is undefined, unless such an expression is a constant expression, in which
case the program is ill-formed. (...)

[ /cite ]

so, use -fwrapv (man g++) to get not quite correct behaviour.


-- 

pluto at agmk dot net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pluto at agmk dot net


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

Reply via email to