Topic: Exception in c'tor of dynamically alloc'd a


Author: swf@elsegundoca.ncr.com (Stan Friesen)
Date: 1995/05/12
Raw View
In article <3oqqut$bsa@engnews2.Eng.Sun.COM>, clamage@Eng.Sun.COM (Steve Clamage) writes:
|>
|> Follow the pointer to _expr.new_. If, e.g., the object was created using
|> a "placement new", it won't be deleted.

It is a little more complicated than that.  As I read it, the rule is:
if the object was created using a "placement new" AND there is no exactly
matching "placement delete", it won't be deleted.

--
swf@elsegundoca.attgis.com  sarima@netcom.com

The peace of God be with you.





Author: clamage@Eng.Sun.COM (Steve Clamage)
Date: 1995/05/10
Raw View
In article 9qo@ritz.cec.wustl.edu, jaf3@ritz.cec.wustl.edu (John Andrew Fingerhut) writes:
>In the latest draft under section 15.2 (Constructors and Destructors),
>paragraph 2 reads:
>
>2 An object that is partially constructed will have destructors executed
>  only for its fully constructed sub-objects.  Should a constructor  for
>  an  element  of  an  automatic array throw an exception, only the con-
>  structed elements of that array will be destroyed.  If the  object  or
>  array  was allocated in a new-expression, the storage occupied by that
>  object is sometimes deleted also (_expr.new_).
>
>What does "sometimes" mean here?

Follow the pointer to _expr.new_. If, e.g., the object was created using
a "placement new", it won't be deleted.



---
Steve Clamage, stephen.clamage@eng.sun.com