static array literal syntax request: auto x=[1,2,3]S;

Timon Gehr timon.gehr at gmx.ch
Sat Jun 9 15:15:01 PDT 2012


On 06/10/2012 12:05 AM, timotheecour wrote:
> (apologies for cross-posting here, I feel this is a better place to ask
> than in my original post where I only received 1 answer that seemed in
> favor of this:
> http://d.puremagic.com/issues/show_bug.cgi?id=8008 which was 2 months ago).
>
> Please see to the original post above to see the proposal for the new
> syntax for static array litterals
> (but please reply here).
>
> Running some simple tests show that this is not just cosmetics and ease
> of use but would also lead to significantly reduced overhead when
> dealing with static array litterals vs raw C array litterals, as
> currently D static array litterals perform costly heap allocation as
> intermediate step (as shown in the resulting assembly).
> ...

D static array literals don't perform a costly heap allocation. It is 
simply a bug in the implementation. This is not a compelling reason to 
add new syntax.


More information about the Digitalmars-d mailing list