lint won't verify printf formatting against variable types??
Paul Hudson
paul at moncam.co.uk
Fri Jun 30 19:20:46 AEST 1989
To:
In article <27729 at lll-winken.LLNL.GOV> berry at lll-crg.llnl.gov (Berry Kercheval) 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 the first *is* a semantic error - x== 5 has no side-effects
(assuming x isn't volatile). A compiler can check for this before
warning about the null statement.
And in this particular case "if (expre);" is always equivalent to
"expr;" - and is IMHO likely to be a programmer error, so it should be
warned about.
--
Paul Hudson MAIL: Monotype ADG, Science Park, Cambridge, CB4 4FQ, UK.
PHONE: +44 (223) 420018 EMAIL: paul at moncam.co.uk,
;" FAX: +44 (223) 420911 ...!ukc!acorn!moncam!paul
`"";";" "/dev/null full: please empty the bit bucket"
More information about the Comp.lang.c
mailing list