Related articles |
---|
Exception Handling david.jobet@ng-market.com (David Jobet) (2002-07-21) |
Re: Exception Handling vbdis@aol.com (VBDis) (2002-07-24) |
Re: Exception Handling casse@netcourrier.com (Casse Hugues) (2002-07-24) |
Re: Exception Handling jacob@jacob.remcomp.fr (jacob navia) (2002-07-24) |
Re: Exception Handling david.jobet@ng-market.com (David Jobet) (2002-07-25) |
Re: Exception Handling journeyman@compilerguru.com (journeyman) (2002-08-04) |
Re: Exception Handling nmm1@cus.cam.ac.uk (Nick Maclaren) (2002-08-10) |
Re: Exception Handling marcov@toad.stack.nl (Marco van de Voort) (2002-08-10) |
Re: Exception Handling max1@mbank.com.ua (Maxim Reznik) (2002-08-10) |
Re: Exception Handling fjh@cs.mu.OZ.AU (Fergus Henderson) (2002-08-14) |
Exception Handling tschirre@cs.curtin.edu.au (Bernhard Tschirren) (1998-09-13) |
Re: Exception Handling mrs@kithrup.com (1998-09-18) |
Re: Exception Handling enikitin@apk.net (1998-09-18) |
[2 later articles] |
From: | "Nick Maclaren" <nmm1@cus.cam.ac.uk> |
Newsgroups: | comp.compilers |
Date: | 10 Aug 2002 01:58:12 -0400 |
Organization: | University of Cambridge, England |
References: | 02-07-075 02-07-110 |
Keywords: | errors |
Posted-Date: | 10 Aug 2002 01:58:12 EDT |
"Casse Hugues" <casse@netcourrier.com> writes:
|> I uses the POSIX C functions setjmp()/lonjmp() from <setjmp.h> for
|> emulating exceptions in my C programs. These functions stores the
|> registers in a memory and restore it when the jump is performed. This is
|> the faster way to implement it I know (in C).
Unfortunately, that only appears to work. The C standard states
explicitly that they will not work for real exception handling, though
you can get them to work for language-created exceptions. Effectively
that means that SYSTEM exceptions (e.g. SIGINT or even I/O errors)
need system-specific code and Assembler.
|> But you must think about memory management because these functions
|> handle only the register and do not know anything about memory. Usually,
|> fast exception handling requires either special memory structure, or
|> garbage collection.
And other things, such as any global mode you set in the library. You
can easily use an extra argument for such state (it is how many
systems did it in the past), but you must pass that down through all
functions, whether they use exceptions or not. There are
optimisations, but they are messy and tricky to get right.
Regards,
Nick Maclaren,
University of Cambridge Computing Service,
New Museums Site, Pembroke Street, Cambridge CB2 3QH, England.
Email: nmm1@cam.ac.uk
Tel.: +44 1223 334761 Fax: +44 1223 334679
Return to the
comp.compilers page.
Search the
comp.compilers archives again.