Lets deprecate the length in the arrays index
Lionello Lunesu
lionello at lunesu.remove.com
Mon Jan 15 09:17:19 PST 2007
"Frank Benoit (keinfarbton)" <benoit at tionex.removethispart.de> wrote in
message news:eogc6d$1tsn$1 at digitaldaemon.com...
>
> Actually I do not like this situation:
>
> int length = 3;
> int[] a = getData();
> writefln( "%d\n", a[length] ); // which length?
>
>
> And I definitely never want to run in this situation:
>
> class A{
> public int size(){ return 0; }
> }
>
> int size = 3;
> A a = getData();
> writefln( "%d\n", a[size-3] ); // woops, A defines size also
That's why I said: the compiler should complain.
L.
More information about the Digitalmars-d
mailing list