On Tuesday, 2 October 2012 at 11:10:46 UTC, Don Clugston wrote:
The problem
-----------
String literals in D are a little bit magical; they have a
trailing \0. This means that is possible to write,
printf("Hello, World!\n");
without including a trailing \0. This is important for
compatibility with C. This trailing \0 is mentioned in the spec
but only incidentally, and generally in connection with printf.
But the semantics are not well defined.
printf("Hello, W" ~ "orld!\n");
If every string literal is \0-terminated, then there should be
two \0 in the final string. I guess that's not the case and
that's actually my preferred behaviour, but the spec should make
it crystal clear in which situations a
string literal gets a terminator and in which not.