Strange lint mumblings

Earle R. Horton earleh at eleazar.dartmouth.edu
Thu Dec 15 00:50:05 AEST 1988


In article <416 at marob.MASA.COM> daveh at marob.masa.com (Dave Hammond) writes:
>Can anyone explain why the statement:
>
>    exit(0);	/* followed immediately by main's closing brace */
>
>causes lint to complain:
>
>ma-main.c
>==============
>(137)  warning: main() returns random value to invocation environment

     Syntactically, "exit(0)" is a function call.  How the heck do you
expect lint to know that exit() never returns?  Since main() is
usually declared to be of type int, then lint is fully justified in
expecting to see a "return <something>" at the end of main().  You
will have to either live with the lint warning, or cause main() to
return something.

     How about:

	return(exit(0));
}

     That should keep lint happy!


Earle R. Horton. 23 Fletcher Circle, Hanover, NH 03755
(603) 643-4109
Graduate student.



More information about the Comp.lang.c mailing list