Empty Array is Null?
BCS
BCS at pathlink.com
Wed Mar 19 14:11:02 PDT 2008
Steven Schveighoffer wrote:
>
> Now, here is the weird part. The compiler does some magic with arrays. If
> you are comparing an array with null, it changes the code to actually just
> compare the array pointer to null. So, the the following code:
>
no this is the weird part:
IIRC this passes.
char* cp = cast(char*)null;
char[] ca = ap[0..15];
assert(ca.ptr == null && ca.length == 15);
More information about the Digitalmars-d-learn
mailing list