Passing arrays by value?

Jarrett Billingsley kb3ctd2 at yahoo.com
Mon Feb 5 05:38:36 PST 2007


"Lionello Lunesu" <lio at lunesu.remove.com> wrote in message 
news:eq78nh$30b1$1 at digitaldaemon.com...
> The spec doesn't specify how fixed-sized arrays are passed to functions 
> (or, I did not find it):
>
> void foo( in float[2] array, float x, float y )
> {
>     array[0] = x;
>     array[1] = y;
> }
>
> It seems to me that an fixed-sized array like that could well be passed by 
> value:
>
> void by_ref( in float[] a, ... );
> void by_value( in float[2] a, ... );
> void by_ref( inout float[2] a, ... );
>
> No?
>
> L.

Fixed-size arrays are passed by reference.  But I suppose passing smaller 
arrays by value could have its uses.. 




More information about the Digitalmars-d-learn mailing list