DMD 1.035 and 2.019 releases
Bill Baxter
wbaxter at gmail.com
Wed Sep 3 23:49:23 PDT 2008
On Thu, Sep 4, 2008 at 2:21 PM, Robert Fraser
<fraserofthenight at gmail.com> wrote:
>>
>> And why not "new S(args)" to call the constructor (which is natural so
>> far) and "S(args)" to work as it does now?
>
> How would you distinguish between allocating the struct on the heap and on
> the stack? "new" anything does heap allocation and returns a
> pointer/reference, so it would be inconsistent if it did stack allocation
> for structs
Except for scope of course:
scope foo = new Foo();
But I would guess for consistency that
scope sfoo = new StructFoo();
should return a pointer to a stack-allocated struct.
--bb
More information about the Digitalmars-d-announce
mailing list