[Issue 2590] Deallocator is not called if constructor fails.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Nov 27 12:05:10 PST 2010


http://d.puremagic.com/issues/show_bug.cgi?id=2590



--- Comment #8 from Max Samukha <samukha at voliacable.com> 2010-11-27 12:03:42 PST ---
Though D is going to deprecate new/delete operators, it is worth noting that
the rule under discussion was adopted by C++ 15 years ago.

>From "Counting Objects in C++" article by Scott Meyers
(http://blog.csdn.net/LYH_Studio/archive/2006/08/11/1051927.aspx):

"For many years this was a hole in the draft C++ language specification, but in
March 1995 the C++ Standards committee adopted the rule that if, during a new
expression, the invocation of operator new succeeds and the subsequent
constructor call throws an exception, the runtime system must automatically
deallocate the memory that operator new allocated. This deallocation is
performed by operator delete, the deallocation analogue of operator new."

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list