On 06/25/2012 03:42 PM, Andrea Fontana wrote:
Using C plain api it's not a good way to use D power IMHO :)

xbuf_ncat(get_reply(argv), "Hello World (D)", "Hello World (C)".sizeof -
1);

Probably this example doesn't work properly.
On my machine writeln("1234".sizeof); gives "16" because of UTF-8.

Actually it gives 16 because sizeof gives the size of
immutable(char)[]. length would give the correct length in this case.

So "1234".sizeof - 1 is 15.

AFAIK D strings are not null-terminated (are they?)

String literals are, but that does not affect their length.

and i guess that line of code won't work.



Reply via email to