std.string.toString(char*) little nuisance
Frits van Bommel
fvbommel at REMwOVExCAPSs.nl
Mon Mar 12 17:35:35 PDT 2007
Tom wrote:
> A question,
>
> shouldn't be documented on the 'std.string.toString(char*)', that the
> d-string returned shares the same buffer as the input c-string?
>
> I've spent some (too much) time debugging to find out why the heck all
> my strings were messing up... now I know.
>
> Mentioning this on the docs could have been of so much help, it's not
> that obvious!
I think it's pretty obvious if you read the first paragraph of
http://www.digitalmars.com/d/phobos/std_string.html, and consider that a
char* c-string is also a 'string' as described in that bit of text. It's
not modified, so a slice of the original is returned (as a D char[]).
Remember: don't just read the function description, the module
description may contain information that applies to all (or a lot of)
the functions in a module.
More information about the Digitalmars-d-bugs
mailing list