[:] as empty associative array literal, plus warning for null
Dmitry Olshansky
dmitry.olsh at gmail.com
Thu Jul 4 12:15:08 PDT 2013
04-Jul-2013 19:00, Regan Heath пишет:
> In fact, you can generalise further.
>
> The meaning of if(x) is "compare the value of x with 0" (in C, C++, .. ).
>
> The value of x for a pointer is the address to which it points.
> The value of x for a class reference is the address of the class to
> which it refers.
>
> If D's arrays are reference types,
They are not. It's a half-reference no wonder it has a bit of
schizophrenia now and then.
then IMO they should exhibit the same
> behaviour.
>
The behavior should be the most useful and since arr.length != 0 is what
99% of time a programmer wants to check.
--
Dmitry Olshansky
More information about the Digitalmars-d
mailing list