Strange lint mumblings
Simon Elliott
sme at computing-maths.cardiff.ac.uk
Tue Dec 20 00:26:24 AEST 1988
In article <11467 at dartvax.Dartmouth.EDU>, earleh at eleazar.dartmouth.edu (Earle R. Horton) 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
> [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 at cunyvm.cuny.edu
UWCC Computer Centre JANET: sme at uk.ac.cf.cm.v1
40/41 Park Place UUCP: {backbones}!mcvax!ukc!reading!cf-cm!sme
Cardiff, Wales PHONE: +44 222 874300
More information about the Comp.lang.c
mailing list