[Exceptional C++ Style] Item 22: To new, Perchance to throw, Part 2: Pragmatic Issues in Memory Management
Adrian Fagg
adrianf at evaluategroup.com
Thu Jan 20 04:01:16 EST 2005
> -----Original Message-----
> From: effective-cpp-bounces at accu.org
> [mailto:effective-cpp-bounces at accu.org]On Behalf Of Jez Higgins
Good summary, but...
> Most forms of new report failure by throwing a bad_alloc
> exception. The
> nothrow new reports a failure by return a null pointer, it wouldn't
> fulfil its guarantee otherwise. (In-place new cannot fail.)
Your confidence in in-place new is surely misplaced. I mean yes, it can't
fail to allocate memory, since it doesn't, but the constructor can still
fail can't it?
Regards,
Adrian
Work: mailto:adrianf at evaluategroup.com
Home: mailto:adrian.fagg at ntlworld.com
Pretty pictures: http://homepage.ntlworld.com/rbyadf/
More information about the Effective-cpp
mailing list