From -659742596519094020 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f78e5,9723061da44e5214 X-Google-Attributes: gidf78e5,public From: Christopher Eltschka Subject: Re: Exception while throwing an exception? Date: 1999/09/07 Message-ID: <37D4C49B.6A95F7B0@physik.tu-muenchen.de>#1/1 X-Deja-AN: 522148161 X-Nntp-Posting-Host: coulomb.t30.physik.tu-muenchen.de Content-Transfer-Encoding: 7bit Approved: stephen.clamage@sun.com (comp.std.c++) References: <37D3E50E.A13D8AFC@prodigy.net> X-Accept-Language: German/Germany, de-DE, German, de, en X-UID: 0000000001 X-Status: $$$T Content-Type: text/plain; charset=us-ascii Organization: [posted via] Leibniz-Rechenzentrum, Muenchen (Germany) Mime-Version: 1.0 Newsgroups: comp.std.c++ Originator: clamage@taumet Andy Larson wrote: > > What is the required behavior when the constructor of an exception > object throws an exception? For example, if an exception is thrown as > in > > throw some_object(some_arguments); > > A constructor of some_object will be called. That constructor may, in > turn, throw an exception. Is the result of this that the original > exception, some_object, is not thrown and is replaced by the exception > that the some_object constructor threw? > > I've searched through the IS to try and find the answer to this question > and have not found anything. Maybe someone here can help. Well, AFAIK the object is first constructed, then thrown. If the constructor of the object throws, the object is not constructed, and not thrown; instead the exception thrown by the constructor of some_object, which _is_ thrown, should propagate down. I don't know how the copy constructor is handled: Is copying the object seen as occuring before throw (i.e. the new exception would be thrown instead of the (not) copied object), or is it seen as part of the throw (i.e. resulting in a double exception and therefore in a terminate call)? [ comp.std.c++ is moderated. To submit articles, try just posting with ] [ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ] [ --- Please see the FAQ before posting. --- ] [ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html ]