🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #3482

Exceptions and Destructors

#3482
From: Brian Glendenning
Date: Thu, 15 Feb 1996 00:48
34 lines
1707 bytes
As I understand it, an object is only considered constructed when its
constructor has finished, so that an exception thrown from within that
constructor will not result in that object's destructor being
called. (Its completely constructed subobjects will be however).

What about the destructor? Is the object considered destructed when
the destructor is *entered*, or when it *completes*?

struct foo : public other
{
    ~foo {throw("BAD?");}
};

Since the above does not result in an infinite loop on the compilers I
have access to, I presume that the object is considered destructed
when the dtor is entered.

Questions:

Is this correct? Is it done this way to ensure in fact that infinite
loops like the above won't happen? How do resources in "other" get
released?

Thanks! -

Brian

-- 
        Brian Glendenning - National Radio Astronomy Observatory
bglenden@nrao.edu              Socorro NM               (505) 835-7347
---
[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  Moderation policy:
  http://reality.sgi.com/employees/austern_mti/std-c++/policy.html. ]
Technical Details
Message-ID: <BGLENDEN.96Feb14173755@colobus.aoc.nrao.edu>
Path: arc1-ca.pugleaf.net!in1.uu.net!bounce-back

Show Full Headers
Complete Article Headers
From: bglenden@colobus.aoc.nrao.edu (Brian Glendenning)
Message-ID: <BGLENDEN.96Feb14173755@colobus.aoc.nrao.edu>
X-Original-Date: 15 Feb 1996 00:37:55 GMT
Path: arc1-ca.pugleaf.net!in1.uu.net!bounce-back
Date: 15 Feb 96 00:48:12 GMT
Approved: fjh@cs.mu.oz.au
Newsgroups: comp.std.c++
Subject: Exceptions and Destructors
Organization: National Radio Astronomy Observatory, Socorro NM
X-Auth: PGPMoose V1.1 PGP comp.std.c++
 iQBFAgUBMSKC2eEDnX0m9pzZAQF5SgF9ExuqbYWINgWIxUkNPxifhP36Ucnuwv2m
 havOZ52jDXRV7qnTC8YVhydohY7sUuuA
 =y6kM