More on C++ stack arrays

David Nadlinger code at klickverbot.at
Mon Oct 21 14:48:08 PDT 2013


On Monday, 21 October 2013 at 21:41:24 UTC, Iain Buclaw wrote:
> I know this, but it does deter me against changing gdc over to 
> stack
> allocating array literals. :-)
>
> I'll mull on it over night.

There is no change in behaviour due to stack-allocating the 
literal in the static array assignment (or just not emitting it 
at all), at least if GDC correctly implements slice <- sarray 
assignment. The dynamic array never "sees" the literal at all, as 
shown by Timon.

In the general case (i.e. when assigned to dynamic arrays), you 
obviously can't stack-allocate literals, but I don't think we 
disagree here.

David


More information about the Digitalmars-d mailing list