[PATCH] Document arithmetic overflow semantics

Robert Dewar dewar@gnat.com
Thu Feb 13 18:50:00 GMT 2003


> The one I mentioned: (a*2)/2

Notice that in Ada this is handled at the language level without any notino
of undefinedness in the semantics (indeed in Ada, integer overflow is usually
very well defined to raise an exception).

However, the intermediate value a*2 will be computed in the base integer type,
and base integer types are unconstrained, which means that it is fine to have
out of range values temporarily if the result is "correct" mathematically.



More information about the Gcc mailing list