Why I (Still) Won't Use D

Sean Kelly sean at invisibleduck.org
Fri Mar 28 10:44:37 PDT 2008


== Quote from Janice Caron (caron800 at googlemail.com)'s article
> On 28/03/2008, Michel Fortin <michel.fortin at michelf.com> wrote:
> > std::string is null terminated in its memory representation;
> No, that's an implementation detail. It's not guaranteed by the C++
> standard. All that is guaranteed is that std::string::c_str() must
> return a null-terminated char array. The standard does not mandate how
> that happens, however.

It does require the returned array to be valid until the string is mutated IIRC,
and that makes null termination of the data the most expedient implementation,
even if it isn't required.  The data in string isn't required to be contiguous
either (unlike vector), though I believe this may have changed in C++ 0x.


Sean



More information about the Digitalmars-d mailing list