On 25/03/2013 5:35 a.m., Kinkie wrote:
Hi all,
   digging up some documentation for the inconsistent behavior of
std::string::find() in GCC, it appears that its behavior is undefined
if the pos parameter is std::string::npos.
I'd like to define that behavior by making it explicit in the API that
SBuf::find (in any variant) when called with pos=SBuf::npos will
return SBuf::npos. This is consistent with recent gcc, but not with
the current implementation

Any comments?

I think it would be a good thing to do.

One other thing that struck me was that we could possibly leverage npos being a large integer value to optimize some of the special case tests as pos>length() as all returning npos. It was not possible to do when making our API exactly match std::string i the fuzzing probably because it hit these inconsistencies.


Amos

Reply via email to