array !is null fails
BCS
ao at pathlink.com
Tue Feb 13 09:12:51 PST 2007
Reply to Jarrett,
> "BCS" <ao at pathlink.com> wrote in message
> news:ce0a334373d48c91d12a1b9c0ec at news.digitalmars.com...
>
>> Ah... I though that [i..i].length == 1?
>>
> Nope, since the second index is noninclusive, [i..i + 1] will be one
> element (just i), and [i..i] is 0.
Oh, Duh. And I've had to correct others on that one :b
>
>> What good is the (array !is null) if it doesn't tell you when the
>> pointer is null?
>>
> Well if you want to see if the pointer is null then use "if(array.ptr
> is null)". Though I'll agree with you that the discontinuity between
> zero-length null pointer arrays and more-than-zero-length null pointer
> arrays is a bit odd.
>
What else could be null? I don't see anything else that it could mean other
than "is the pointer null".
More information about the Digitalmars-d-learn
mailing list