Empty array vs. null array (WAS: Re: Arrays)

Janice Caron caron800 at googlemail.com
Sat Apr 26 07:07:38 PDT 2008


On 26/04/2008, Bruno Medeiros <brunodomedeiros+spam at com.gmail> wrote:
> Walter Bright wrote:
>  >>
>  >> 2) An empty array is equal to a null pointer. Yikes!
>  >
>  > Not exactly, although a null array is also an empty array, the reverse is
> not true.
>
>  Really? So what exactly is the difference?

If (array.length == 0) then it's an empty array.
If (array.ptr == 0 && array.length == 0) then it's a null array.



More information about the Digitalmars-d mailing list