Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!bloom-beacon!bu-cs!mirror!frog!john From: john@frog.UUCP (John Woods) Newsgroups: comp.lang.c Subject: Re: Strange lint mumblings Summary: Lint has the right feature Keywords: lint exit Message-ID: <1322@X.UUCP> Date: 19 Dec 88 04:35:00 GMT References: <416@marob.MASA.COM> <1037@alobar.ATT.COM> Distribution: na Organization: Servants of the Great White Frog Lines: 31 In article <1037@alobar.ATT.COM>, grs@alobar.ATT.COM (Gregg Siegfried) writes: > In article <416@marob.MASA.COM> daveh@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@frog.UUCP, ...!mit-eddie!jfw, jfw@eddie.mit.edu Go be a `traves wasswort. - Doug Gwyn