This is the mail archive of the gcc-bugs@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]
Other format: [Raw text]

[Bug libstdc++/13084] class string with find(const char* cstr, size_type idx) member have different gcc 2.95 and gcc 3.3 behaviour


------- Additional Comments From paolo at gcc dot gnu dot org  2003-11-18 09:04 -------
I strongly suspect submitter is thinking about this kind of testcase

#include <string>
#include <cassert>

int main()
{
  std::string aaa = "Francesca";

  char* lit = "";
  assert( aaa.find(lit) == 0 );

  std::string str("");
  assert( aaa.find(str) == 0 );
}

What happens here, is that v2's find returns 9 whereas v3 returns 0 (for
both the tests)

Now, 9 is definitely wrong since is past the end of the string aaa and
find is supposed to return aither a valid index inside aaa or string::npos.

However, I'm not deadly sure that 0 is correct: just let me think a bit more
about the issue...

Paolo.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |ASSIGNED
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2003-11-18 09:04:49
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13084


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