lint won't verify printf formatting against variable types??
Badger BA 64810
bbadger at x102c.harris-atd.com
Thu Jun 29 23:45:05 AEST 1989
In article <27729 at lll-winken.LLNL.GOV> berry at lll-crg.llnl.gov (Berry Kercheval) writes:
>In article <441a30e5.8f55 at fiero.engin.umich.edu>, ejd at caen (Edward J Driscoll) writes:
>>It [[ if(x==5); ]]is legal, but I would hope for a warning from such an
>> obvious semantic error.
>
>Goodness, save me from useless warnings for perfectly good C
>constructs. This is NOT an "obvious" semantic error. Have you never
>done something like this?
>
> /* skip to end of word */
> while(!isspace(*cp++));
>
>Admittedly, I usually code it as:
>
> while(!isspace(*cp++))
> /* null */ ;
>
>but it's very useful at times.
>
> --berry
However,
if(x==5);
most certainly is useless, in fact,
if(<<expression>>);
is *completely* equivalent to
<<expression>>;
semantically. This isn't true for ``while(<<expression>>);'', in general.
Since this is an obvious abuse of syntax, I would *hope* --
but not necessarily *expect* -- that lint would catch such an error.
It is something which could be added to the list of probable errors which
lint should check for. Because it is so easy to habitually add a ';' to the
end of a statement, it's an easy trap.
Give the guy a break -- he didn't say he expected ``cc'' to catch it, he
just hoped that ``lint'' would. That's lint's job: finding *legal* constructs
which aren't portable or probably aren't what was intended.
Bernard A. Badger Jr. 407/984-6385 |``Use the Source, Luke!''
Secure Computer Products |``Get a LIFE!'' -- J.H. Conway
Harris GISD, Melbourne, FL 32902 |Buddy, can you paradigm?
Internet: bbadger%x102c at trantor.harris-atd.com|'s/./&&/g' Tom sed expansively.
More information about the Comp.lang.c
mailing list