String class

Pages: 12
I think you could have said that a bit better, but...use string::npos, don't use -1. It's like assuming NULL is equal to 0...when it could easily be some memory address the OS defines to catch NULL pointers.
Well, if I recall correctly, the standard says that assigning a pointer to zero must map to an adress the OS uses for null pointers.
Nobody can know better than Stroustrup: http://www.research.att.com/~bs/bs_faq2.html#null
Topic archived. No new replies allowed.
Pages: 12