More on C++ stack arrays

Iain Buclaw ibuclaw at ubuntu.com
Mon Oct 21 14:54:18 PDT 2013


On 21 October 2013 22:48, David Nadlinger <code at klickverbot.at> wrote:
> 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.
>

That we do not.  :o)


-- 
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';


More information about the Digitalmars-d mailing list