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

William E. Davidsen Jr davidsen at steinmetz.ge.com
Fri Jul 1 23:14:23 AEST 1988


In article <741 at vsi.UUCP> friedl at vsi.UUCP (Stephen J. Friedl) writes:
| Hi net.folks,
| 
|      For some unknown reason, I have always felt uncomfortable
| doing a return(n) from main: I used exit(n) instead.  Can anybody

  Some versions of C don't use the value of the return from main as a
call to exit. Instead, the assume that if you don't call exit with a
value you terminated normally and should have a zero exit status. Your
gut feeling is a good one, it will save you a lot of pain in the long
run, I suspect.

-- 
	bill davidsen		(wedu at ge-crd.arpa)
  {uunet | philabs | seismo}!steinmetz!crdos1!davidsen
"Stupidity, like virtue, is its own reward" -me



More information about the Comp.lang.c mailing list