The more interesting question

deadalnix deadalnix at gmail.com
Tue May 15 09:45:39 PDT 2012


Le 15/05/2012 17:51, Christophe a écrit :
> deadalnix , dans le message (digitalmars.D:167404), a écrit :
>> This looks to me like a bad practice. C string and D string are
>> different beasts, and we have toStringz .
>
> C string and D string are different, but it's not a bad idea to have
> string *literals* that works for both C and D strings, otherwise using
> printf will lead to a bug each time the programmer forget the trailing
> \0.
>
>> It is kind of dumb to create a WAT is the language because druntime dev
>> did mistakes. It have to be fixed.
>
> You can't rely on an empty string to be null since you must be able to
> reserve place at the end of the array, and or the string could be the
> result of poping a full string.

This is why I stated put null when the string length is SET to 0, not 
when it is 0.

So it is nulled when I create an empty slice, or do arr.length = 0


More information about the Digitalmars-d mailing list