is there anything wrong with return(n) from main?

Christoph Kuenkel ckl at uwbln.UUCP
Fri Jul 15 19:03:53 AEST 1988


In article <741 at vsi.UUCP>, friedl at vsi.UUCP (Stephen J. Friedl) writes:
>      For some unknown reason, I have always felt uncomfortable
> doing a return(n) from main: I used exit(n) instead.  Can anybody
> think of any possible reason why a return is not a good idea? 
There are simply some implementations of _startup() that don't take care of
the returnvalue of main() (we have that problem here). You should code:
main() {
	...
	exit(retcode);
	/*NOTREACHED*/
}
This should work in any case.
christoph
-- 
Christoph Kuenkel/UniWare         ck at tub.BITNET
Kantstr. 152                      uunet!unido!tub!ck
1000 Berlin 12                    {unido,tmpmbx,uwnue,nixbln,tub}!uwbln!ckl
West Germany



More information about the Comp.lang.c mailing list