Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!uunet!mcvax!ukc!acorn!moncam!paul From: paul@moncam.co.uk (Paul Hudson) Newsgroups: comp.lang.c Subject: Re: lint won't verify printf formatting against variable types?? Message-ID: Date: 30 Jun 89 09:20:46 GMT References: <328@tree.UUCP> <417@siswat.UUCP> <441a30e5.8f55@fiero.engin.umich.edu> <27729@lll-winken.LLNL.GOV> Sender: paul@moncam.co.uk Organization: Monotype ADG, Cambridge, UK. Lines: 30 In-reply-to: berry@lll-crg.llnl.gov's message of 29 Jun 89 02:27:43 GMT To: In article <27729@lll-winken.LLNL.GOV> berry@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@moncam.co.uk, ;" FAX: +44 (223) 420911 ...!ukc!acorn!moncam!paul `"";";" "/dev/null full: please empty the bit bucket"