DIP9 -- Redo toString API
Steven Schveighoffer
schveiguy at yahoo.com
Fri Nov 19 06:32:29 PST 2010
On Fri, 19 Nov 2010 09:30:11 -0500, bearophile <bearophileHUGS at lycos.com>
wrote:
> Steven Schveighoffer:
>
>> Who said setting an array to null is bad practice? I disagree. null
>> is a
>> better way to represent it, because it sets both the ptr and the length
>> to
>> 0, while "" only sets the length to 0.
>>
>> char[] arr = "";
>>
>> assert(arr == null); // passes
>> assert(arr is null); // fails
>
> I see, I didn't know this.
BTW, the default value is not part of the function signature, if you want
to in your code use = "", as long as you do the comparison correct, it
should be valid.
-Steve
More information about the Digitalmars-d
mailing list