mwarning wrote: > Anyway, the D spec says: > "Static arrays are value types, but as in C static arrays are passed to > functions by reference and cannot be returned from functions." > (http://www.digitalmars.com/d/1.0/arrays.html#static-arrays)
I've been thinking D2. :) In D2, fixed-sized arrays are value types and copied to and from functions:
import std.stdio; int[2] foo(int[2] array) { writeln("in foo : ", &(array[0])); return array; } void main() { int[2] array; writeln("in main 1: ", &(array[0])); int[2] result = foo(array); writeln("in main 2: ", &(result[0])); } All three addresses are separate in D2. Ali