Top 5

Benji Smith dlanguage at benjismith.net
Fri Oct 10 10:30:23 PDT 2008


Denis Koroskin wrote:
> On Fri, 10 Oct 2008 19:54:33 +0400, Benji Smith 
> <dlanguage at benjismith.net> wrote:
> 
>> I think *all* arrays should be declared like this:
>>
>>     T[] array = new T[n];
>>
> 
> You often want to avoid heap allocation at all cost. It can't be done as 
> you propose.

For all other reference types, allocation on the stack is accomplished 
with the "scope" keyword, without having a different type, or a 
different constructor-call syntax. I think the same thing could apply to 
arrays just as easily.

--benji



More information about the Digitalmars-d mailing list