Integer conversions too pedantic in 64-bit

Kagamin spam at here.lot
Thu Feb 17 06:45:14 PST 2011


dsimcha Wrote:

> Funny, as simple as it is, this is a great idea for std.array because it 
> shortens the verbose cast(int) a.length to one extra character.  You 
> could even put an assert in it to check in debug mode only that the 
> conversion is safe.

> > int ilength(void[] a) @property
> > {
> >    return cast(int)a.length;
> > }

I'm not sure the code is correct. I have a vague impression that void[] is like byte[], at least, it's used as such, and conversion from int[] to byte[] multiplies the length by 4.


More information about the Digitalmars-d mailing list