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


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.




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