home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky gnu.g++.help:1038 comp.lang.c++:11457
- Newsgroups: gnu.g++.help,comp.lang.c++
- Path: sparky!uunet!cis.ohio-state.edu!osprey.shef.ac.uk!tony
- From: tony@osprey.shef.ac.uk (a j cornah)
- Subject: Request for information about setjmp/longjmp in g++
- Message-ID: <12467.9207231555@acse.sheffield.ac.uk>
- Sender: gnulists@ai.mit.edu
- Organization: Gatewayed from the GNU Project mailing list help-g++@prep.ai.mit.edu
- Date: Thu, 23 Jul 1992 15:55:52 GMT
- Lines: 38
-
- I have been looking at providing a similar feature to Ada EXCEPTIONs in
- Modula-2, C and C++. What I need to do this reasonably cleanly is a
- facility which works like "setjmp" but for one routine down:
-
- a()
- {
- if (b() != 0)
- {
- printf("Something happened\n"); <----------+
- return; |
- } /* endif (b() != 0) */ |
- c(); |
- } |
- |
- int ^
- b() |
- { |
- return( MYsetjmp(buffer) ); |
- } |
- |
- c() |
- { |
- longjmp(buffer); /* This returns to the code up here ->-+
- * rather than being wrong because b
- * has already returned
- */
-
- In TURBO C++ I can obtain the source of the runtime library and modify the
- setjmp code to save the value of the previous stack frame fairly easily.
- I had a quick look at the source of g++ but it wasn't obvious whether I could
- do the same and expect the same result.
-
- Could you please tell me where to look for the code I need?
-
- Thanks in anticipation of a reply
-
- Tony Cornah
-
-