Variable lengh arrays of fixed length arrays

Derek Parnell derek at
Fri Aug 4 00:03:41 PDT 2006

On Fri, 04 Aug 2006 08:50:40 +0200, Oskar Linde wrote:
>> Walter, please justify this anomaly and why I should embrace this apparent
>> lose of reason.
> I guess there is a very obvious answer. This is all how static arrays 
> work in C.

Except that I don't care what C does, I'm working with D now. 
> Making static arrays assignable (by copying the elements) means that 
> static arrays would turn into value types, which IMHO is much better 
> than their current state of being neither value nor reference types.
> It would affect functions like:
> void func(ubyte[10_000_000] buffer) {...}
> But I doubt such cases are very common in D code. 

And the coder gets what they deserve in those cases <G>

> Calling extern(C) 
> functions would still require the passing of a reference of course.

That's why we have .ptr property for arrays.

  cFunc( fixedarray.ptr );

(skype: derek.j.parnell)
Melbourne, Australia
"Down with mediocrity!"
4/08/2006 5:01:17 PM

More information about the Digitalmars-d-learn mailing list