[Issue 1869] Semantically returning an array from a funciton is difficult
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Feb 25 15:03:50 PST 2008
http://d.puremagic.com/issues/show_bug.cgi?id=1869
------- Comment #2 from jason at spashett.com 2008-02-25 17:03 -------
(In reply to comment #1)
> The reason that static arrays can't be returned is that they are pointers to
> local variables. That is in reference to this code:
> >int[10] a;
> >return a;
>
> however IIRC you can have a function return type int[4]:
> >int[4] fn(int i, int[4][4] j) { return j[i]; }
>
> I guess I'm not realy understanding what your concern is.
>
Is this new in D 2.x ?
I get main.d(813): Error: functions cannot return static array int[4u]
with your example.
My example is for a two dimensional array, which up until fairly recently was
hard to initialise from a static array (until recently dmd 2.0 changelog)
Is it the case therefore that dmd 2.x supports returning of static arrays?
--
More information about the Digitalmars-d-bugs
mailing list