James W. McKelvey <mckelvey@xxxxxxxxxxx> writes: > When chars are implemented as signed, characters with negative values compare > properly as individual chars, but improperly when part of a char array or > std::string -- they compare as unsigned. The problem appears to be that the > specialization of std::char_traits<char> uses memcmp. This is observed on an > Alpha running RH 7.1 and gcc version 3.5.0 20040207. I see the same behavior with gcc 3.4.0 on i686-freeBSD5.2 > > Specifically, std::char_traits<char>::compare is inconsistent with > std::char_traits<char>::lt, which affects std::string (which is just > std::basic_string<char>.) The problem also affects strcmp, strncmp, and > strcoll. [snip] std::char_traits<char>::compare is defined in terms of std::char_traits<char>::lt in 21.1.1/1 table 37, and I can't find a reason why they might be allowed to be inconsistent. I think you should report a bug, see gcc.gnu.org/bugs.html