May 27, 2009 [Issue 3032] New: No stack allocation for "scope c = new class Object {};" | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=3032 Summary: No stack allocation for "scope c = new class Object {};" Product: D Version: 1.044 Platform: PC OS/Version: Linux Status: NEW Keywords: performance Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla@digitalmars.com ReportedBy: fvbommel@wxs.nl (Found in 1.045, but that isn't in the version list) In the following code 'bar' is heap-allocated even though it's "scope bar = new ...": ----- void foo() { scope bar = new class Object {}; // on heap } ----- If the class is given a name then it's stack-allocated: ----- void foo() { class Anon : Object {} scope bar = new Anon; // on stack } ----- (Look at the disassembled output to see the difference) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation