Re: Exception in C
- From: Justin Spahr-Summers <Justin.SpahrSummers@xxxxxxxxx>
- Date: Fri, 31 Aug 2007 20:26:23 -0000
On Aug 31, 12:17 pm, Laurent Deniau <Laurent.Den...@xxxxxxxxx> wrote:
For who are interested, I have updated my exception module (very
small) that I published on the web few years ago. It is now compatible
with multithreads (TLS) to follow a growing demand for an update of my
old code which wasn't. It is a complete refactoring imported and
adapted (simplied) from the C Object System for C89.
I think that what you're doing can invoke unexpected behavior on some
platforms. According to C99 (which I realize you're not using, but I
highly doubt the longjmp() restrictions would be more constraining),
"the values of objects of automatic storage duration that are local to
the function containing the invocation of the corresponding setjmp
macro that do not have volatile-qualified type and have been changed
between the setjmp invocation and longjmp call are indeterminate." For
your EX_TRY macro, you're defining a struct ex_cxt object with
automatic storage duration named ex_lcxt which gets modified inside
ex_throw() (albeit through a different variable at that point) before
longjmp() is called, so when execution gets to EX_CATCH() or
EX_CATCH_ANY(), it's perfectly legal for ex_cxt to be total garbage.
.
- References:
- Exception in C
- From: Laurent Deniau
- Exception in C
- Prev by Date: Re: Porting C software
- Next by Date: Re: pointer conversion
- Previous by thread: Exception in C
- Next by thread: programming languages
- Index(es):
Relevant Pages
|