🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #4686

Re: atexit() and return from main()

#4686
From: Stephen Baynes
Date: Mon, 22 Jan 1996 09:05
33 lines
1955 bytes
Tanmoy Bhattacharya (tanmoy@qcd.lanl.gov) wrote:
: --text follows this line--
: 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:
<snip>
:    main() calls setjmp() and then calls exit().  An atexit() function
:    calls longjmp() and returns to main().  This repeats (or does it?)

: Neither of these is permitted in any sense that I understand!
: 7.10.4.3: If more than one call to the exit function is executed by
: a program, the behaviour is undefined. No `permission by omission'
: that I can see.

In this example what happens if no second call to exit is been made (after
longjumping back to main the program does not attempt to call exit again -
instead it keeps executing indefinately)?

Does a return from main count as a call to exit for the purposes of the
one call restriction in 7.10.4.3? I assume it does because it is regarded
as equivalent.

What happens if an atexit function calls atexit ? If you interpret the
standard strictly I think the program has to enter a timewarp back to the
call to exit and start with the just registered atexit function!



--
Stephen Baynes                              baynes@mulsoc2.serigate.philips.nl
Philips Semiconductors Ltd
Southampton                                 My views are my own.
United Kingdom
Technical Details
Message-ID: <DLKrx7.6p6@ukpsshp1.serigate.philips.nl>
Path: arc1-ca.pugleaf.net!phcoms4.seri.philips.nl!panther!baynes
References: <4dhfja$j50@fg70.rz.uni-karlsruhe.de> <4diicg$i9e@lyra.csx.cam.ac.uk> <TANMOY.96Jan18084025@qcd.lanl.gov>

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c
Path: arc1-ca.pugleaf.net!phcoms4.seri.philips.nl!panther!baynes
From: baynes@ukpsshp1.serigate.philips.nl (Stephen Baynes)
Subject: Re: atexit() and return from main()
Sender: news@ukpsshp1.serigate.philips.nl (account for localnews)
Message-ID: <DLKrx7.6p6@ukpsshp1.serigate.philips.nl>
Date: Mon, 22 Jan 1996 09:05:31 GMT
References: <4dhfja$j50@fg70.rz.uni-karlsruhe.de> <4diicg$i9e@lyra.csx.cam.ac.uk> <TANMOY.96Jan18084025@qcd.lanl.gov>
Organization: Philips Semiconductors, Southampton, UK
X-Newsreader: TIN [version 1.2 PL2]