null == "" is true?

ag0aep6g anonymous at example.com
Tue Jul 12 19:55:46 UTC 2022


On Tuesday, 12 July 2022 at 19:02:01 UTC, user1234 wrote:
> On Tuesday, 12 July 2022 at 16:40:38 UTC, H. S. Teoh wrote:
[...]
>> Do not rely on this, however;
>
> Absolutely. I'd like to add: especially as default parameter 
> value that's an array. Never use null. use `[]` (empty array 
> literal).

Just to be clear: `[]` and `null` are the exact same thing (null 
pointer, zero length). The reason to prefer `[]` over `null` is 
purely for readability. The meaning is exactly the same.


More information about the Digitalmars-d-learn mailing list