digitalmars.D.bugs - [Issue 2032] New: Documentation for creating a class on the stack is unintuitive
- d-bugmail puremagic.com (29/29) Apr 24 2008 http://d.puremagic.com/issues/show_bug.cgi?id=2032
- d-bugmail puremagic.com (9/9) May 22 2008 http://d.puremagic.com/issues/show_bug.cgi?id=2032
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 --
Apr 24 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2032 bugzilla digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED Fixed dmd 1.030 and 2.014 --
May 22 2008