What can you "new"

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Mar 24 21:54:38 PDT 2009


Cristian Vlasceanu wrote:
> Andrei Alexandrescu Wrote:
> 
>> Steve Teale wrote:
>>> Andrei Alexandrescu Wrote:
>>>
>>>> Sean Kelly wrote:
>>>>> == Quote from Andrei Alexandrescu (SeeWebsiteForEmail at erdani.org)'s article
>>>>>> Jarrett Billingsley wrote:
>>>>>>> On Mon, Mar 23, 2009 at 2:04 PM, Andrei Alexandrescu
>>>>>>> <SeeWebsiteForEmail at erdani.org> wrote:
>>>>>>>> Nothing.
>>>>>>>>
>>>>>>>> auto a = T(args);
>>>>>>>>
>>>>>>>> should create a T, whether T is a class, array, struct, what have you. This
>>>>>>>> "new" business is lame, lame, lame.
>>>>>>> Struct on stack vs. heap?
>>>>>> Allocating a struct on heap should invoke a function a la create!(T).
>>>>> Hm... so I guess we'd need support for placement construction?
>>>> Yah, that (together with explicit destruction) should be in the language 
>>>> anyway to support custom allocation and such.
>>>>
>>>> Andrei
>>>
>>> A bag of worms it would appear!
>>>
>> Well yah but you can use them to catch big fish.
>>
>> Andrei
> 
> Do custom-allocated objects live on the GC-ed heap? 

Not necessarily, e.g. you can malloc some memory and then create an 
object there.

Andrei



More information about the Digitalmars-d mailing list