On 4/20/15 12:14 PM, Kagamin wrote:
On Sunday, 19 April 2015 at 08:05:46 UTC, Jonathan M Davis wrote:
the C folks would think that
the current behavior of it being equivalent to if(arr is null) would
be more
intuitive, since they're used to thinking of arrays as pointers.

Are they used to disregard value types too? I don't see it working in C:
http://ideone.com/rzSSlx

Not exactly. Because C arrays are pointers, it does work that way:

void foo(int c[])
{
   if(c) {...} // same as if(c is null)
}

But C doesn't have any other possible piece to check, as the length of the array is not part of the code.

The closest equivalent is C++ vectors, and if(someVector) doesn't work.

-Steve

Reply via email to