Article View: comp.std.c
Article #4659Re: atexit() and return from main()
From: Lawrence Kirby
Date: Wed, 17 Jan 1996 23:57
Date: Wed, 17 Jan 1996 23:57
24 lines
1429 bytes
1429 bytes
In article <4diicg$i9e@lyra.csx.cam.ac.uk>
nmm1@cus.cam.ac.uk "Nick Maclaren" writes:
>In article <4dhfja$j50@fg70.rz.uni-karlsruhe.de>, ig25@fg70.rz.uni-karlsruhe.de
> (Thomas Koenig) writes:
>|> I don't see a problem when I replace the 'return 0' above with
>|> an 'exit(0)'.
>
>I do. exit() may unwind the stack before calling the atexit()
>functions, and that is actually the way that most C run-time
>systems implement close down.
Implementations that do that are non-conforming. According to 7.10.4.3:
"First, all functions registered by the atexit function are called, in
the reverse order of registration."
There is no license given to destroy any existing objects before that happens.
--
-----------------------------------------
Lawrence Kirby | fred@genesis.demon.co.uk
Wilts, England | 70734.126@compuserve.com
-----------------------------------------
Technical Details
Message-ID:
<821923074snz@genesis.demon.co.uk>Path:
arc1-ca.pugleaf.net!mail2news.demon.co.uk!genesis.demon.co.ukReferences:
<4dhfja$j50@fg70.rz.uni-karlsruhe.de> <4diicg$i9e@lyra.csx.cam.ac.uk>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!mail2news.demon.co.uk!genesis.demon.co.uk From: Lawrence Kirby <fred@genesis.demon.co.uk> Newsgroups: comp.std.c Subject: Re: atexit() and return from main() Date: Wed, 17 Jan 96 23:57:54 GMT Organization: none Message-ID: <821923074snz@genesis.demon.co.uk> References: <4dhfja$j50@fg70.rz.uni-karlsruhe.de> <4diicg$i9e@lyra.csx.cam.ac.uk> Reply-To: fred@genesis.demon.co.uk X-NNTP-Posting-Host: genesis.demon.co.uk X-Newsreader: Demon Internet Simple News v1.27 X-Mail2News-Path: genesis.demon.co.uk