Array allocations [was: Re: What does C++...]

Peter Alexander peter.alexander.au at gmail.com
Sat Jul 30 12:55:52 PDT 2011


On 30/07/11 8:45 PM, bearophile wrote:
> Don:
>
>> Yeah, it's not fundamental, and not even very complicated. The current
>> implementation was a quick hack to provide the functionality, that
>> hasn't been replaced with a proper implementation yet. All that's
>> required to fix it is a bit of code in e2ir.c.
>
> Thank you for your (positive) answer. Generally optimizations have a lower priority than nasty bugs. I use enough fixed-sized arrays in my D code (I think of it as a good practice I have learnt from reading Ada code, and sometimes I initialize them from literals. Ada programs are higher level than C but they use stack allocations most of the times. There are stack-allocated variable-size arrays too), so I'd like this optimization. Sometimes I use fixed-size arrays as keys of associative arrays, to remove one indirection level.
>
> Bye,
> bearophile

It would be very good if this optimisation was done. Also, I think it 
would be worth while adding it to the language definition so that it's 
not merely an implementation detail.


More information about the Digitalmars-d mailing list