home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!taumet!steve
- From: steve@taumet.com (Steve Clamage)
- Subject: Re: setjmp/longjmp question
- Message-ID: <1993Jan26.182029.23023@taumet.com>
- Organization: TauMetric Corporation
- References: <1993Jan8.195613.14303@cadkey.com> <KANZE.93Jan25184636@slsvdnt.us-es.sel.de>
- Date: Tue, 26 Jan 1993 18:20:29 GMT
- Lines: 21
-
- kanze@us-es.sel.de (James Kanze) writes:
-
-
- >The C++ standards committee have said that they are adopting the C
- >library more or less integrally, so I would suppose that this means
- >setjmp/longjmp too.
-
- Yes, but with a caution. If the longjmp bypasses destruction of
- automatic objects, the results are undefined.
-
- In other words, if you have C code which uses setjmp/longjmp and is
- otherwise legal C++ code, it will still be legal C++ code. If you
- add creation of auto objects which have destructors between the
- setjmp and the longjmp, the code no longer has defined semantics.
- (This could happen by calling a C++ routine from the original C code,
- for example.)
-
- The idea is to use exceptions rather than setjmp/longjmp in new code.
- --
-
- Steve Clamage, TauMetric Corp, steve@taumet.com
-