April 25, 2008 [Issue 2032] New: Documentation for creating a class on the stack is unintuitive | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=2032 Summary: Documentation for creating a class on the stack is unintuitive Product: D Version: unspecified Platform: All URL: http://www.digitalmars.com/d/1.0/memory.html#stackclass OS/Version: All Status: NEW Keywords: spec Severity: normal Priority: P2 Component: www.digitalmars.com AssignedTo: bugzilla@digitalmars.com ReportedBy: schveiguy@yahoo.com When I first read the spec on creating a class on the stack, I thought the 3rd rule meant that I could not instantiate a stack class with parameters to the constructor. After asking the question to digitalmars.D.learn, I have learned that it means the new function cannot have parameters. Since almost everyone does not use new parameters, and usually uses constructor parameters, it would be good to clarify that the rule specifically means new parameters and not constructor parameters. e.g.: * use new with no arguments (constructor arguments are allowed) And it would be even clearer if there were more examples: class C { ... } scope c = new C(); // c is allocated on the stack scope c2 = new C(5); // allocated on stack scope c3 = new(5) C(); // allocated by a custom allocator -- |
May 22, 2008 [Issue 2032] Documentation for creating a class on the stack is unintuitive | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=2032 bugzilla@digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED ------- Comment #1 from bugzilla@digitalmars.com 2008-05-22 04:59 ------- Fixed dmd 1.030 and 2.014 -- |
Copyright © 1999-2021 by the D Language Foundation