Make int[12] convertible to int[]

bearophile via Digitalmars-d digitalmars-d at puremagic.com
Wed Dec 17 06:00:39 PST 2014


Shachar Shemesh:

> The subject pretty much says it all.
>
> If I have a function:
> void function(int[] arr);
>
> I'd like to be able to call it with:
>
> int[12] a;
> function(a);
>
> I know I can do:
> function(a[]);
>
> It just seems like extra unneeded superfluous unnecessary 
> redundancy. I don't see any static typing protection/errors 
> prevented from doing this.

Currently it works:


void foo(int[] arr) {}
void main() {
     int[12] a;
     foo(a);
}


Bye,
bearophile


More information about the Digitalmars-d mailing list