lint won't verify printf formatting against variable types??

Karl Heuer karl at haddock.ima.isc.com
Fri Jun 30 07:09:21 AEST 1989


In article <115 at borabora.omni.com> bob at omni.com (Bob Weissman) writes:
>I'm talking about
>	if (expression);
>which, while legal, *never* makes sense semantically

Well, some versions of |<assert.h>| do this deliberately.  (But these should
be fixed anyway, since the pANS requires |assert()| to be a void-valued
expression macro, and it's not hard to do this.)  And I have, myself, used a
null-bodied |if| with an |else| clause, in situations where this was clearer
than a straight |if| with the condition inverted.

It would be within the "spirit of lint" to warn about *all* null statements,
provided (a) any instance can be silenced with the lintpragma |/*NULL*/|, and
(b) the warning can be disabled by a command-line option.  (Probably |if| and
|while| should have separate flags, since many people depend on null-bodied
|while|.)

Why warn about null |while| at all?  Because it's *possible* that it's a typo,
just as with |if|; and those of use who never write it that way would be able
to make good use of the warning.  (Some of us always use |/*NULL*/|, or use
empty braces instead of a semicolon, or write |do; while (ex);| whenever the
entire loop is contained in the test.)

Karl W. Z. Heuer (ima!haddock!karl or karl at haddock.isc.com), The Walking Lint
________
Note: I'll be out of town July 2-22, so I probably won't be able to reply to
any followups.  If you send me mail, include enough context that I'll still
remember the thread three weeks later.



More information about the Comp.lang.c mailing list