Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!ucsd!sdcsvax!trantor.harris-atd.com!x102c!bbadger From: bbadger@x102c.harris-atd.com (Badger BA 64810) Newsgroups: comp.lang.c Subject: Re: lint won't verify printf formatting against variable types?? Keywords: lint, cc Message-ID: <2271@trantor.harris-atd.com> Date: 29 Jun 89 13:45:05 GMT References: <328@tree.UUCP> <417@siswat.UUCP> <441a30e5.8f55@fiero.engin.umich.edu> <27729@lll-winken.LLNL.GOV> Sender: news@trantor.harris-atd.com Reply-To: bbadger@x102c.harris-atd.com (Badger BA 64810) Organization: Harris GISD, Melbourne, FL Lines: 42 In article <27729@lll-winken.LLNL.GOV> berry@lll-crg.llnl.gov (Berry Kercheval) writes: >In article <441a30e5.8f55@fiero.engin.umich.edu>, ejd@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(<>); is *completely* equivalent to <>; semantically. This isn't true for ``while(<>);'', 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@trantor.harris-atd.com|'s/./&&/g' Tom sed expansively.