stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Sebor <se...@roguewave.com>
Subject Re: svn commit: r387631 - /incubator/stdcxx/trunk/tests/strings/21.string.capacity.cpp
Date Fri, 24 Mar 2006 19:29:18 GMT
Anton Pevtsov wrote:

> I added UserChars to this test. The updated version is attached
> 
> Here is the change log:

Looks good.

FYI: the difference between string::c_str() and string::data()
is that the former guarantees that returned value points to a NUL
terminated character string (i.e., the function may append it if
it's not there), while the latter isn't required to do that. For
this reason data() should be preferred when interacting with
traditional C functions that expect NUL-terminated strings, while
data() should be used in all other contexts, especially those where
no reallocation of the string should be done. In our implementation
(and all others I'm aware of), there is no difference between the
two functions.

Martin



Mime
View raw message