Length of fixed size arrays
Jonathan M Davis
jmdavisProg at gmx.com
Sat Nov 17 11:08:18 PST 2012
On Saturday, November 17, 2012 18:19:50 Benjamin Thaut wrote:
> That would be nice, but a bigger problem I'm currently having, is
> that you can not initialize fixed size arrays like this:
>
> int[4] bla = [1,2,3,4];
>
> Without causing a allocation. The literal will be allocated on
> the heap, then copied onto the stack, and then it will become
> garbage.
It's a well-known issue and will be fixed at some point. I suspect that it's
simply a matter of one of the compiler devs making it a priority, but I don't
know what all is involved in making the change. Certainly, it's an
implementation issue rather than a language issue. My guess though is that it
hasn't been tackled primarily because it's a performance issue, whereas so
many other bugs actually result in incorrect programs.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list