Exception from "delete"

Is it a rule that built-in C++ functions
 
delete


and

 
delete []


can't throw exceptions?
No, but throwing exceptions from destructors isn't the greatest idea in the world.
Since delete can throw exceptions and since destructors call delete and since exceptions should not be thrown from within destructors, does it mean that there should be try/catch blocks within all destructors (who will call delete)?
Let me clarify -

delete itself -- the keyword -- will not throw. But there is nothing in the language that prevents destructors from throwing (though it is a bad idea), which means technically speaking, it is
possible for delete foo; to throw if foo's destructor or something it calls can throw.

However, a good rule of thumb is never let exceptions leak from a destructor.

Thank you vey much jsmith!
Topic archived. No new replies allowed.