[Exceptional C++ Style] Item 22: To new, Perchance to throw, Part 2: Pragmatic Issues in Memory Management

Jez Higgins jez at jezuk.co.uk
Thu Jan 20 04:29:24 EST 2005


> 
> 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?
> 

Perhaps I was a little loose in my wording.  It's memory allocation 
that's the topic of this item, which in-place new can't fail at.  Yes, 
the constructor could throw an exception, but that's a different class 
of error to memory exhaustion ... unless it failed due to memory 
exhaustion, in which case we're back to bad_alloc or null pointers.

Jez


--- StripMime Report -- processed MIME parts ---
multipart/signed
  text/plain (text body -- kept)
  application/pgp-signature
---



More information about the Effective-cpp mailing list