home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / cplus / 19971 < prev    next >
Encoding:
Text File  |  1993-01-28  |  1.1 KB  |  32 lines

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