arrays: if(null == [ ])
Timon Gehr
timon.gehr at gmx.ch
Mon May 14 15:07:24 PDT 2012
On 05/14/2012 01:51 PM, deadalnix wrote:
> Le 14/05/2012 12:49, Gor Gyolchanyan a écrit :
>> So, null arrays and empty arrays are always the same, except for an
>> empty string, which is a valid non-nill array of characters with length
>> 0, right?
>>
>
> If it is the current behavior, it deserve a WAT !
I agree, but it is explained easily. Built-in string literals are always
zero-terminated, therefore an empty string literal must point into
accessible memory. I'd like to have [] !is null as well, so that null
can reliably be used as a sentinel value.
More information about the Digitalmars-d
mailing list