Static arrays passed by value..?

BCS none at anon.com
Sat Aug 7 16:52:00 PDT 2010


Hello simendsjo,

> The spec for array says:
> Static arrays are value types. Unlike in C and D version 1, static
> arrays are passed to functions by value. Static arrays can also be
> returned by functions.
> 
> I don't get the "static arrays are passed to functions by value" part.
> 
> Here I am passing in a static and dynamic array. Both are passed by
> value, and the function can modify the array of both

What that is saying is that "if the type of the function arg is a static 
array..." not "if the value passed to the function is a static array..."

An example of a function taking a static array is:

void Fn(int[5] arr){ ... }

-- 
... <IXOYE><





More information about the Digitalmars-d-learn mailing list