Strange lint mumblings

John Woods john at frog.UUCP
Mon Dec 19 14:35:00 AEST 1988


In article <1037 at alobar.ATT.COM>, grs at alobar.ATT.COM (Gregg Siegfried) writes:
> 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:
> >(137)  warning: main() returns random value to invocation environment
>To nuke this message, use return rather than exit.

Even better is:

	main() {
		do_something_important();
		exit(0);
		/* NOTREACHED */
	}

the /* NOTREACHED */ lint directive instructs lint as to exactly what is going
on.  It also instructs the reader as to exactly what is going on.

It would have been nice if lint could have been taught that lint-library
functions with a definition something like

	void exit(n) int n; { /* NOTREACHED */ }

will never return, but on the other hand, making that manifest for the reader
in the place of use has benefits.
-- 
John Woods, Charles River Data Systems, Framingham MA, (508) 626-1101
...!decvax!frog!john, john at frog.UUCP, ...!mit-eddie!jfw, jfw at eddie.mit.edu

Go be a `traves wasswort.		- Doug Gwyn



More information about the Comp.lang.c mailing list