This is the mail archive of the libstdc++@sources.redhat.com 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]

string's operator == fails for empty string


 I noticed that the empty string "" is found equal to any string, when using libstdc++-v2.
When using v3 the behaviour is normal.

#include <string>
#include <iostream>

int main() {
using namespace std;
string nawak="Ce g++ fait n\'importe nawak.";
cerr<<nawak<<" is an empty string : "
    << (nawak=="")<<endl;
}


g++ -v 
Reading specs from /home/krempp/egcs/bin/../lib/gcc-lib/i686-pc-linux-gnu/2.97/specs
Configured with:  --prefix=/home/krempp/egcsv2 --enable-shared
gcc version 2.97 20001103 (experimental)

--> says nawak and "" are equal.

While --enable-libstdcxx-v3  says they differ.

-- 
Sam

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