Type of Array.length?

Heinz billgates at microsoft.com
Sat Jan 20 13:04:48 PST 2007


Chris Nicholson-Sauls Wrote:

> Heinz wrote:
> > Alexander Panek Wrote:
> > 
> >> Heinz wrote:
> >>> Hi,
> >>>
> >>> I just want to know what type is the one returned by the .length property of an array.
> >>>
> >>> Thanks.
> >> Easiest way to achieve the array is either:
> >>
> >> typeof(array.length) len;
> >>
> >> or:
> >>
> >> auto len = array.length;
> >>
> >>
> >> You don't even have to really care for the type then, actually, and it 
> >> stays platform independent, anyways.
> > 
> > Hi, thanks for your reply, i really like what yo did but i need this type to be fixed, not stored in a variable. Ok, now len is the same type as array.length, then what's the type of len? you know what i mean?
> > The program knows the type but I need to know it too.
> > Thanks man.
> > 
> 
> size_t
> (Which is 'uint' on 32b systems, and 'ulong' on 64b.)
> 
> -- Chris Nicholson-Sauls

You're right. I wrote the array.length into a binary file and it uses only 4 bytes. Thanks.


More information about the Digitalmars-d-learn mailing list