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

T. William Wells bill at proxftl.UUCP
Mon Jul 4 18:50:07 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?  I
> have the feeling that my discomfort is entirely unfounded...

The only reason I can think of is broken compilers. The two
should be equivalent. Of course, one of those broken compilers
is the one we have ... on a Sun 3 running SunOS 3.4. It acts as
if return (n) were a return (0). [I understand that that
has been fixed in a later release.]



More information about the Comp.lang.c mailing list