I found an apparent contradiction in the c++ text having to do with the result of the
c_str() function operating on
std:strings (in my copy, the definition and contradiction are on p1040).
First it defines the
c_str() function as something that produces a 'C-style' (zero-terminated) string, but later it talks about how a C++ c_str value can have embed a 'C'-style, end-of-string terminators (i.e. NUL's) embedded in the string (that is defined by being NUL terminated).
Um... does anyone else feel that this is a 'stretching' of the definition of a C-string beyond it's definition? I.e. I think what it means, is that if you were to look at the
length() function as applied to the
string, it will show a different end of string than using the C-definition of a z-string -- one that can contain any character except NUL, and is terminated by NUL.
I likely don't have to worry about it in my of my programs, but it seems like a subtle distinction that makes a C++
c_str, not really a 'C'-string. Am I misunderstanding this issue?