arrays: if(null == [ ])

Gor Gyolchanyan gor.f.gyolchanyan at gmail.com
Mon May 14 07:31:00 PDT 2012


No, it doesn't. Appending to a null array is equivalent to allocating a new
array.

On Mon, May 14, 2012 at 6:29 PM, H. S. Teoh <hsteoh at quickfur.ath.cx> wrote:

> On Mon, May 14, 2012 at 05:00:25PM +0400, Gor Gyolchanyan wrote:
> > I think any kind of null array should be different from an array of
> > zero length.
>
> But that defeats the utility of idioms like:
>
>        int[] arr;
>        arr ~= 123;
>        ...
>
>
> T
>
> --
> There are four kinds of lies: lies, damn lies, and statistics.
>



-- 
Bye,
Gor Gyolchanyan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20120514/a07069e1/attachment.html>


More information about the Digitalmars-d mailing list