This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/13650] string::compare should not (always) use traits_type::length()


------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]