Article View: comp.std.c
Article #4649atexit() and return from main()
From: Thomas Koenig
Date: Wed, 17 Jan 1996 00:24
Date: Wed, 17 Jan 1996 00:24
26 lines
1141 bytes
1141 bytes
Is the following valid C?
#include <stdio.h>
#include <stdlib.h>
char *a;
void printit()
{
printf("%s",a);
}
int main()
{
char buffer[]="Hello, world!\n";
a = buffer;
atexit(printit);
return 0;
}
6.1.2.4 tells me it isn't, but 5.1.2.2.3 tells me that a return from the
initial call to main() is equivalent to an exit(), and I don't see a problem
when I replace the 'return 0' above with an 'exit(0)'.
--
Thomas Koenig, Thomas.Koenig@ciw.uni-karlsruhe.de, ig25@dkauni2.bitnet.
The joy of engineering is to find a straight line on a double
logarithmic diagram.
Technical Details
Message-ID:
<4dhfja$j50@fg70.rz.uni-karlsruhe.de>Path:
arc1-ca.pugleaf.net!rz.uni-karlsruhe.de!not-for-mailShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!rz.uni-karlsruhe.de!not-for-mail From: ig25@fg70.rz.uni-karlsruhe.de (Thomas Koenig) Newsgroups: comp.std.c Subject: atexit() and return from main() Date: 17 Jan 1996 01:24:10 +0100 Organization: Universität Karlsruhe (TH), Germany Message-ID: <4dhfja$j50@fg70.rz.uni-karlsruhe.de> Reply-To: Thomas.Koenig@ciw.uni-karlsruhe.de NNTP-Posting-Host: fg70.rz.uni-karlsruhe.de Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit NNTP-Posting-User: ig25