This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


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

Re: libstdc++/2672


The following reply was made to PR libstdc++/2672; it has been noted by GNATS.

From: pme@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org, logan@gedanken.org, nobody@gcc.gnu.org
Cc:  
Subject: Re: libstdc++/2672
Date: 29 Apr 2001 01:20:08 -0000

 Synopsis: std::string.compare(char*,0,n) fails to match partial strings where string::compare(string&,0,n) does
 
 State-Changed-From-To: open->closed
 State-Changed-By: pme
 State-Changed-When: Sat Apr 28 21:20:08 2001
 State-Changed-Why:
     Thank you for your bug report.
     
     First, libstdc++ has been completely replaced with
     a written-from-scratch libstdc++-v3.  The compare()
     member functions you mention do not exist in that
     form in the ISO C++ standard.  (Their argument order
     is different.)
     
     After making that change to your code, and using gcc
     version 3.0 20010427 (prerelease) I get:
     
         31% cat 2672.cc
         #include <iostream>
         #include <string>
     
         using std::string;
         using std::cout;
         using std::endl;
     
         int main()
         {
           string a = "prefix::name";
           cout << "compare against char* returns "
                << a.compare(0, 8, "prefix::") << endl;
     
           string b = "prefix::";
           cout << "compare against string& returns "
                << a.compare(0, 8, b) << endl;
         }
         32% g++ -W -Wall 2672.cc
         33% ./a.out
         compare against char* returns 0
         compare against string& returns 0
         34%
     
     So it appears that the new version is correct.
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=2672&database=gcc


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