This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Document arithmetic overflow semantics
- From: dewar at gnat dot com (Robert Dewar)
- To: kenner at vlsi1 dot ultra dot nyu dot edu, roger at www dot eyesopen dot com
- Cc: gcc-patches at gcc dot gnu dot org, gcc at gcc dot gnu dot org
- Date: Thu, 13 Feb 2003 13:39:15 -0500 (EST)
- Subject: Re: [PATCH] Document arithmetic overflow semantics
> 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.