This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [PATCH] Fix collate_members_char[wchar_t].cc
- From: Paolo Carlini <pcarlini at unitus dot it>
- To: Ulrich Drepper <drepper at redhat dot com>
- Cc: libstdc++ at gcc dot gnu dot org
- Date: Wed, 13 Mar 2002 23:06:58 +0100
- Subject: Re: [PATCH] Fix collate_members_char[wchar_t].cc
- References: <1016056922.16743.1073.camel@myware.mynet>
Ulrich Drepper wrote:
> 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.
Ok. Thanks.
> 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'm not sure to understand what you mean here. Comparing with str1.compare(str2)
(as in my patch) gives indeed the /same/ result obtained via collate::compare.
FAIL: 26_numerics/c99_classification_macros_c.cc (test for excess errors)
=== libstdc++-v3 Summary ===
# of expected passes 358
# of unexpected failures 1
# of unexpected successes 25
Ciao, Paolo.