string::compare() problem?

Paolo Carlini pcarlini@suse.de
Sun Mar 21 16:53:00 GMT 2004


Hi,

first, the current behavior is correct: strings are compared 
"lexicographically":
ever wondered why in your dictionary 'express' comes before 
'expressionism'? ;)

>Why doesn't this give 0? According to my reading of the function, it should 
>only compare the first 2 chars of each string.
>
>	int __r = traits_type::compare(_M_data(), __str.data(), __len);
>	if (!__r)
>	  __r =  __size - __osize;
>
If...

Paolo.



More information about the Libstdc++ mailing list