A
Alien
npos is defined as -1, in both SGI and VS.
So npos+1=0?
I remember that I read a book saying that npos+1==npos.
So npos+1=0?
I remember that I read a book saying that npos+1==npos.
npos is defined as -1, in both SGI and VS.
So npos+1=0?
I remember that I read a book saying that npos+1==npos.
Alien said:npos is defined as -1, in both SGI and VS.
So npos+1=0?
I remember that I read a book saying that npos+1==npos.
Thomas said:Alien wrote:
The value of npos is implementation defined. On many platforms it is
-1, but there is no requirement that that be the case. So don't rely
on it.
Best regards,
Tom
Thomas said:Alien wrote:
npos is defined as -1, in both SGI and VS.
So npos+1=0?
I remember that I read a book saying that npos+1==npos.
The value of npos is implementation defined. On many platforms it is
-1, but there is no requirement that that be the case. So don't rely
So, it's not defined in the standard?
Kai-Uwe Bux has proven me wrong. It's defined in std::basic_string as
const size_type npos = -1;
I would have sworn Jossutis said it was implementation-defined.
Sorry to lead you astray.
Best regards,
Tom
Thomas said:Thomas said:Alien wrote:
npos is defined as -1, in both SGI and VS.
So npos+1=0?
I remember that I read a book saying that npos+1==npos.
The value of npos is implementation defined. On many platforms it is
-1, but there is no requirement that that be the case. So don't rely
Kai-Uwe Bux has proven me wrong. It's defined in std::basic_string as
const size_type npos = -1;
I would have sworn Jossutis said it was implementation-defined.
He should have been right, except that it was originaly unspecified, not
implementation defined. Its purpose was to provide a sentinel value,
nothing more. Somehow unspecified got changed to -1, and that's led far
too many people to write code based on that particular value.
--
-- Pete
Author of "The Standard C++ Library Extensions: a Tutorial and
Reference." For more information about this book, see
www.petebecker.com/tr1book.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.