This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Do C++ signed types have modulo semantics?
- From: Michael Veksler <VEKSLER at il dot ibm dot com>
- To: gcc at gcc dot gnu dot org
- Date: Mon, 27 Jun 2005 08:09:08 +0300
- Subject: Do C++ signed types have modulo semantics?
According to the (very) long discussion on VRP, signed char/short/int/etc
do not have modulo semantic, they have an undefined behavior on overflow.
However in <limits> defines numeric_limits<signed type>::is_modulo = true.
1. Is that a bug in <limits>, a bug in the standard, or is just C++
different
than C in this respect?
2. Maybe because overflow is undefined then is_modulo maybe
considered "unspecified". I don't like this option, because it does not
help
generic programming.
3. Do I understand what is_modulo stands for?
4. What should be done (libstdc++ PR, C++ PR, DR, other)?
I have seen this in gcc-4.0-20050602, and gcc-3.4.3
Michael