Path: utzoo!utgpu!attcan!uunet!seismo!sundc!pitstop!sun!quintus!ok From: ok@quintus.uucp (Richard A. O'Keefe) Newsgroups: comp.lang.c Subject: Re: Strange lint mumblings Keywords: lint exit Message-ID: <877@quintus.UUCP> Date: 16 Dec 88 00:52:45 GMT References: <416@marob.MASA.COM> <1037@alobar.ATT.COM> Sender: news@quintus.UUCP Reply-To: ok@quintus.UUCP (Richard A. O'Keefe) Distribution: na Organization: Quintus Computer Systems, Inc. Lines: 19 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 Note that exit() can be called *anywhere*, not just in main(). In particular, it can legitimately be called in functions which do NOT return 'int' (e.g. many of my report-error-and-drop-dead functions are declared 'void'), so the "return exit(0)" kludge that two posters have suggested so far really isn't a very good idea. If you read the lint documentation you will find that it understands some special comments. In particular, the way to handle things like exit() and longjmp() is exit(0); /*NOTREACHED*/ which is reasonably clear to human readers as well.