This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Do C++ signed types have modulo semantics?
- From: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- To: Morten Welinder <mwelinder at gmail dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: 27 Jun 2005 17:20:36 +0200
- Subject: Re: Do C++ signed types have modulo semantics?
- References: <118833cc050627073918793062@mail.gmail.com>
Morten Welinder <mwelinder@gmail.com> writes:
| | signed types are undefined on overflow. [5/5] and [3.9.1/2,3]
|
| > But a compiler could define them to be modulo -- that is the whole
| > point. The paragraph does not say they don't "modulo".
|
| True, but you are going to have to deal with the run-time version of
|
| (int)0x80000000 / -1
|
| which is unpleasant in the sense that Intel processors will trap and not
| do anything modulo-like.
If such things really yields undefined behaviour on Intel's then
numeric_limits<> for Intel's should be changed accoordingly. It does
not imply that numeric_limits<>::is_modulo is false for all targets
supported by GCC.
-- Gaby