The more interesting question

Timon Gehr timon.gehr at gmx.ch
Tue May 15 11:23:53 PDT 2012


On 05/15/2012 10:39 AM, deadalnix wrote:
> 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 not. Claiming valid use cases are bad practice does not help the 
discussion. It is disrespectful and patronising.

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

The conclusion is based on a wrong premise therefore it is meaningless.

> It have to be fixed.

It can be fixed better by making (null !is []) hold instead of making 
("" is null) hold.


More information about the Digitalmars-d mailing list