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

paolo at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Tue Nov 18 09:58:00 GMT 2003


------- Additional Comments From paolo at gcc dot gnu dot org  2003-11-18 09:58 -------
On second tought, the true reason why 9 is not ok whereas 0 *is* ok is that,
according to the standard (21.3.6.1, p1): "determines the _lowest_ possible
xpos, if possible, such as both the following conditions..." (emphasis mine).

Now, "the following conditions" are fulfilled both by 0 and 9, and 0 is the
correct final answer. This is also consistent with the behavior for the general
str.find(lit, pos = 0), returning pos for lit == "" (when pos <= str.size(),
otherwise npos, of course).

I'm closing the report as not a bug.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |INVALID


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



More information about the Gcc-bugs mailing list