The more interesting question

deadalnix deadalnix at gmail.com
Tue May 15 01:39:23 PDT 2012


Le 14/05/2012 19:38, Alex Rønne Petersen a écrit :
> On 14-05-2012 15:21, Gor Gyolchanyan wrote:
>> I thing the zero-terminated literal shtick is pointless. Literals are
>> rarely passed to C functions, so we gotta use the std.utf.toUTFz anyway.
>>
>> On Mon, May 14, 2012 at 5:03 PM, Christophe
>> <travert at phare.normalesup.org <mailto:travert at phare.normalesup.org>>
>> wrote:
>>
>> deadalnix , dans le message (digitalmars.D:167258), a écrit :
>> > A good solution would be to set the pointer to 0 when the length
>> is set
>> > to 0.
>>
>> String literal are zero-terminated. "" cannot point to 0x0,
>> unless we drop this rule. Maybe we should...
>>
>>
>>
>>
>> --
>> Bye,
>> Gor Gyolchanyan.
>
> This is very false. I invite you to read almost any module in druntime.
> You'll find that it makes heavy use of printf debugging.
>
> That being said, dropping the null-termination rule when passing strings
> to non-const(char)* parameters/variables/etc would be sane enough (I
> think).
>

This looks to me like a bad practice. C string and D string are 
different beasts, and we have toStringz .

It is kind of dumb to create a WAT is the language because druntime dev 
did mistakes. It have to be fixed.


More information about the Digitalmars-d mailing list