This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/13650] string::compare should not (always) use traits_type::length()
- From: "paolo at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 12 Jan 2004 21:04:53 -0000
- Subject: [Bug libstdc++/13650] string::compare should not (always) use traits_type::length()
- References: <20040112041332.13650.jlabusch@eservglobal.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From paolo at gcc dot gnu dot org 2004-01-12 21:04 -------
Hi.
There are a few issues, here, and the proposed patch is incorrect.
1- The standard had a defect, DR 5 (TC) (see also DR 87),
http://anubis.dkuug.dk/jtc1/sc22/wg21/docs/lwg-defects.html#5
indeed, one of the very first discovered, which implies that we _cannot_
unify the two different compare as you are suggesting.
2- The version missing the fourth parameter is ok as-is.
3- The version with the fourth size_type parameter should be tweaked,
however, I'm working on it. Basically (see also Josuttis, p. 512),
'\0' has no special meaning and s _must_ have at least n2 chars:
therefore __osize == __n2, always.
Thanks,
Paolo.
P.S. I have also checked two other well known implementations and both
are consistent with 1-, 2-, 3- above.
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |paolo at gcc dot gnu dot org
|dot org |
Status|NEW |ASSIGNED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13650