More on C++ stack arrays

Adam D. Ruppe destructionator at gmail.com
Sun Oct 20 09:58:26 PDT 2013


On Sunday, 20 October 2013 at 16:33:35 UTC, Walter Bright wrote:
> Stack allocated arrays are far more trouble than they're worth. 
> But what about efficiency? Here's what I often do something 
> along the lines of:

Aye, that's a pretty good solution too.

>     scope (exit) if (a != tmp) delete a;

but I think you meant if(a is tmp) :)

Though, even that isn't necessarily right since you might use a 
to iterate through it (e.g. a = a[1 .. $]), so I'd use a separate 
flag variable for it.


More information about the Digitalmars-d mailing list