W
wijhierbeneden
On http://www.parashift.com/c++-faq-lite/freestore-mgmt.html
in [16.9] In p = new Fred(), does the Fred memory "leak" if the Fred
constructor throws an exception?
there is this code:
// Original code: Fred* p = new Fred();
Fred* p = (Fred*) operator new(sizeof(Fred));
try {
new(p) Fred(); // Placement new
} catch (...) {
operator delete(p); // Deallocate the memory
throw; // Re-throw the exception
}
What exception can placement new throw???
in [16.9] In p = new Fred(), does the Fred memory "leak" if the Fred
constructor throws an exception?
there is this code:
// Original code: Fred* p = new Fred();
Fred* p = (Fred*) operator new(sizeof(Fred));
try {
new(p) Fred(); // Placement new
} catch (...) {
operator delete(p); // Deallocate the memory
throw; // Re-throw the exception
}
What exception can placement new throw???