Article View: comp.std.c
Article #4675Re: atexit() and return from main()
From: J. Kanze
Date: Fri, 19 Jan 1996 11:49
Date: Fri, 19 Jan 1996 11:49
27 lines
1750 bytes
1750 bytes
In article <4dkvjk$6q5@lyra.csx.cam.ac.uk> nmm1@cus.cam.ac.uk (Nick
Maclaren) writes:
[...]
> However, for the advanced paper, think about the following problems:
>
> What is the effect of an atexit() function calling exit()? Does it
> restart the atexit() queue, carry on as if the function had returned
> or does it abandon the atexit() queue?
>
> I chose to do the second, as by far the most user-friendly, but I
> would NEVER write serious code that relied upon that action!
>
> main() calls setjmp() and then calls exit(). An atexit() function
> calls longjmp() and returns to main(). This repeats (or does it?)
>
> This is ALSO permitted by omission, but a good run-time system will
> trap it, issue an error message and stop without calling more atexit()
> functions.
According to ISO 9899: "If more than one call to the exit function is
executed by a program, the behavior is undefined."
--
James Kanze (+33) 88 14 49 00 email: kanze@gabi-soft.fr
GABI Software, Sarl., 8 rue des Francs Bourgeois, 67000 Strasbourg, France
Conseils, études et réalisations en logiciel orienté objet --
-- A la recherche d'une activité dans une region francophone
Technical Details
Message-ID:
<KANZE.96Jan19124945@gabi.gabi-soft.fr>Path:
arc1-ca.pugleaf.net!gabi-soft.fr!usenetReferences:
<4dhfja$j50@fg70.rz.uni-karlsruhe.de> <4diicg$i9e@lyra.csx.cam.ac.uk> <821923074snz@genesis.demon.co.uk> <4dkvjk$6q5@lyra.csx.cam.ac.uk>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!gabi-soft.fr!usenet From: kanze@gabi.gabi-soft.fr (J. Kanze) Newsgroups: comp.std.c Subject: Re: atexit() and return from main() Date: 19 Jan 1996 11:49:45 GMT Organization: GABI Software, Sarl. Message-ID: <KANZE.96Jan19124945@gabi.gabi-soft.fr> References: <4dhfja$j50@fg70.rz.uni-karlsruhe.de> <4diicg$i9e@lyra.csx.cam.ac.uk> <821923074snz@genesis.demon.co.uk> <4dkvjk$6q5@lyra.csx.cam.ac.uk> NNTP-Posting-Host: gabi.gabi-soft.fr In-reply-to: nmm1@cus.cam.ac.uk's message of 18 Jan 1996 08:15:48 GMT