This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ 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]

Re: [PATCH] Fix collate_members_char[wchar_t].cc


On Wed, 2002-03-13 at 13:39, Paolo Carlini wrote:

>    string str1 = coll_c.transform(strlit1, strlit1 + size1);
>    string str2 = coll_c.transform(strlit2, strlit2 + size2);
> -  i1 = coll_c.compare(str1.c_str(), str1.c_str() + size1,
> -         str2.c_str(), str2.c_str() + size2);
> +  i1 = str1.compare(str2);
>    i2 = coll_c.compare(strlit1, strlit1 + size1, strlit2, strlit2 + size2);
> -  VERIFY(i1 == i2);
> +  VERIFY(i2 == 1);
> +  VERIFY(i1 * i2 > 0);

The first change is correct, normal string comparison is needed after
the transformation.  But the results should still be the same.  If you
see a different sign on the return value it could mean that instead

  i1 = str2.compare(str1)

must be used (or that .compare is returning the wrong sign which I
doubt).  I've not enough time to look into this myself.

-- 
---------------.                          ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------

Attachment: signature.asc
Description: This is a digitally signed message part


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