Uploaded image for project: 'C++ Standard Library'
  1. C++ Standard Library
  2. STDCXX-1035

Issue with string::find(const string& str, size_type pos=0)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 4.1.4, 4.2.0, 4.2.1
    • 4.2.2
    • 21. Strings
    • None
    • All

    • Regression
    • Incorrect Behavior

    Description

      I recently encountered a problem with stdcxx demonstrated by the following example:

      #include <string>
      
      int main()
      {
          std::string s = ".google.com";
          std::string s1 = "www.google.google.com";
      
          std::string::size_type pos = s1.find(s);
          if (pos != std::string::npos)
          {
              return 0;
          }
          else
          {
              return 1;
          }
      }
      

      The code above was compiled using the sun studio 12 compiler:

      CC -library=%none -I/spare/include/stdcxx -L/spare/lib -lstd12d -mt -lpthread google.cpp
      

      With the stdcxx 4.2.1 library, the return code is 1 indicating that find failed. However the return code is 0 when using sun studio with the Cstd or STLPort4 libraries. Compiling with g++ 4.1 on Linux also returns 0 indicating that find was successful.

      Attachments

        Issue Links

          Activity

            People

              farid Farid Zaripov
              briannesbitt Brian Nesbitt
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: