Am 27.04.2011 01:22, schrieb Daniel Gibson: > Am 27.04.2011 00:58, schrieb bearophile: >> so: >> >>> I agree with others, we need the best documentation we can get on this >>> subject. >> >> In-place allocation (or generally other forms of manual allocation and >> deallocation) of class instances in D2 is a topic well fit for a *long* >> article for the iPad2 contest (written for future D programmers coming from >> C++ too), and later this good article has to go among the D docs of the >> official documentation :-) >> >> Bye, >> bearophile > > The D2 documentation should stop advertising custom allocators via new() > and delete() and the scope storage class. > This means http://www.digitalmars.com/d/2.0/memory.html and > http://www.digitalmars.com/d/2.0/comparison.html (possibly more) should > be rewritten or adjusted. > BTW the comparison also lists strong typedefs which are also to be > deprecated AFAIK. > > Furthermore: Why is emplace() in std.conv? I really wouldn't expect it > there.. more likely I'd look in std.typecons, because scoped!T() is > already there and does something related (allocate an object without new). > > And while I'm complaining: > http://www.digitalmars.com/d/2.0/phobos/phobos.html doesn't list core.stdc.* > > Cheers, > - Daniel
Oh and http://www.digitalmars.com/d/2.0/phobos/core_memory.html should also be adjusted in GC.free(): "If finalization is desired, use delete instead." Should probably changed to "If finalization is desired, call clear() on the Object/struct before calling GC.free()" or something like that. I just noticed something regarding clear(): struct Bar { ... } Bar *b = new Bar(); This compiles without any warning, but doesn't call the destructor: clear(b); This compiles without any warning and actually does what you'd expect, i.e. calls destructor: clear(*b); Is this behavior expected/wanted? If not: Is it a known bug? I couldn't find it in the bugtracker, but maybe I searched for the wrong keywords. Cheers, - Daniel
