new T[size] vs .reserve

bearophile bearophileHUGS at lycos.com
Sun Feb 3 05:22:52 PST 2013


Era Scarecrow:

> On Sunday, 3 February 2013 at 09:11:59 UTC, Namespace wrote:
>> Sure, but alloca has the same ugly interface as malloc. :/
>
>  You mean that you have to specify how many raw bytes you want, 
> then cast it to what you need? I never thought alloca or malloc 
> were that ugly.

The interface of alloca() is bug-prone. And it's not handy if you 
want to create a 2D or nD array on the stack :-) In bugzilla 
there is a preliminary request for better and less bug-prone VLAs 
for D.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list