[Bug libstdc++/22200] numeric_limits<signed>::is_modulo is inconsistend with gcc
gdr at integrable-solutions dot net
gcc-bugzilla@gcc.gnu.org
Mon Jun 27 18:23:00 GMT 2005
------- Additional Comments From gdr at integrable-solutions dot net 2005-06-27 18:23 -------
Subject: Re: numeric_limits<signed>::is_modulo is inconsistend with gcc
"pinskia at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:
| ------- Additional Comments From pinskia at gcc dot gnu dot org 2005-06-27 17:29 -------
| (In reply to comment #7)
| > Andrew --
| >
| > You do not seem to understand this PR. Please DO NOT close it.
| > Your eagerness to close PRs is doing harms -- that was already debated
| > last couple o weeks and I do not want to repeat that again.
|
| yes it will be debated until the end of time. INT_MIN/-1 is undefined as declared by the C/C++
| standards so this is invalid. we get modulo results most of the time, but again since this is undefined,
The issue is whether that modulo result is taken to be the definition that
GCC gives to the operation. At this point, saying "the standard
says it is undefined behaviour" is pointless and unhelpful.
| we may as well say it is modulo because it is.
Yes, that is part of the issue.
| I think the standard say that if two postive values are
| added to and you __may__ get a value that is less than both of them,
yes, but at this point we're more interesting in what GCC decides that
behaviour should be. It is irrelevant to say "the standard says it is
undefined behaviour".
| then is_modulo should be set to true. (I don't have the copy right in front of me right now but IIRC that is what it says)
|
|
| In fact from the comment in std_limits.h says "if possible" meaning "may":
| /** True if the type is @e modulo, that is, if it is possible to add two
| positive numbers and have a result that wraps around to a third number
| that is less. Typically false for floating types, true for unsigned
| integers, and true for signed integers. */
Thanks, I'm the author of <limits>. For all useful purposes, please
Andrew go back and read the link I gave to RTH's message.
-- Gaby
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22200
More information about the Gcc-bugs
mailing list