Path: utzoo!attcan!uunet!mcvax!ukc!reading!cf-cm!sme From: sme@computing-maths.cardiff.ac.uk (Simon Elliott) Newsgroups: comp.lang.c Subject: Re: Strange lint mumblings Summary: Lint Directives Message-ID: <592@cf-cm.UUCP> Date: 19 Dec 88 14:26:24 GMT References: <416@marob.MASA.COM> <11467@dartvax.Dartmouth.EDU> Organization: University of Wales College of Cardiff, Cardiff, WALES, UK. Lines: 36 In article <11467@dartvax.Dartmouth.EDU>, earleh@eleazar.dartmouth.edu (Earle R. Horton) 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 > [discussion deleted] > How about: > return(exit(0)); > } Well, in my manual (Section 2: 'Lint, a C Program Checker' by S.C.Johnson) there is a section entitled 'Shutting Lint Up', with a comment to the effect that sometimes the programmer is smarter than lint. Following is a discussion of the directives (syntactically comments) that a programmer can use to let lint know that the programmer really knows what (s)he is doing. Among these are: /*VARARGS*/ preceding a function definition, to let lint know it shouldn't complain about variable numbers of arguments to calls of the following function. /*NOTREACHED*/ to let lint know that a particular spot in the code is never executed. There are several more such directives. -- -------------------------------------------------------------------------- Simon Elliott Internet: sme%v1.cm.cf.ac.uk@cunyvm.cuny.edu UWCC Computer Centre JANET: sme@uk.ac.cf.cm.v1 40/41 Park Place UUCP: {backbones}!mcvax!ukc!reading!cf-cm!sme Cardiff, Wales PHONE: +44 222 874300