longjmp out of signal handler (was Re: alloca() portability)
Henry Spencer
henry at zoo.toronto.edu
Sat Nov 17 05:14:36 AEST 1990
In article <15 at christmas.UUCP> rtm at island.uu.net (Richard Minner) writes:
>>As soon as you mention `longjmp out of signal handlers' you have left
>>either portability or reliability far behind (even if you are careful,
>>doing *anything* with signals tends to make software unportable).
>>
>Please Chris, could you spare a few paragraphs to elaborate on this?
In case Chris doesn't have paragraphs to spare right now, here's a few
sentences. :-) It is extremely difficult to guarantee that anything
will work portably in signal handlers, because the stranger C environments
put bizarre restrictions on them due to difficulties with calling conventions
and the like. ANSI C specifies as "undefined" almost any interaction with
the world outside the signal handler except (a) calling signal() to reset
that particular signal, and (b) assigning a variable to a flag of a specific
(implementation-defined) type. In particular, it is impossible to guarantee
that longjmp() will work from within a signal handler, because there are
machines where it won't. This is really annoying in the presence of 4BSD's
gratuitous breakage of the default semantics of signals, but there is
nothing that can be done about it.
--
"I don't *want* to be normal!" | Henry Spencer at U of Toronto Zoology
"Not to worry." | henry at zoo.toronto.edu utzoo!henry
More information about the Comp.lang.c
mailing list