The comments in basic_string.h above std::basic_string::compare(...) and therefore the Doxygen-generated documentation do not correctly describe the behaviour of the compare() member function.
In all cases, the comments describe compare() as comparing strings by length first, and calling traits::compare second. However, the code (and presumably the standard?) performs these in the opposite order, to provide a proper lexicographical compare. -- Summary: Documentation for std::basic_string::compare() incorrect Product: gcc Version: unknown Status: UNCONFIRMED Severity: minor Priority: P3 Component: libstdc++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: IRSWalker at ntlworld dot com CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21035