Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!sun-barr!newstop!texsun!texbell!nuchat!moray!urchin!p6.f506.n106.z1.fidonet.org!Bob.Stout From: Bob.Stout@p6.f506.n106.z1.fidonet.org (Bob Stout) Newsgroups: comp.lang.c Subject: Re: lint won't verify printf formatting against variable types?? Message-ID: <16398.24B11BB6@urchin.fidonet.org> Date: 4 Jul 89 08:20:45 GMT Sender: ufgate@urchin.fidonet.org (newsout1.26) Organization: FidoNet node 1:106/506.6 - Fulcrum's Edge, Spring TX Lines: 29 In an article of <28 Jun 89 08:32:33 GMT>, Goran Larsson writes: >In article <105@borabora.omni.com> bob@omni.com (Bob Weissman) writes: >>Last week I spent an entire day tracking down one of those bugs you just >>don't see after staring at your code too long. It was of the form: >> >> if (condition); >> action; > >It's your own fault -- you should have written it as > if ( condition ) { > action; > } >to reduce the risk of errors! > >>My lint (SunOS 4.0.1 version) did not flag the extra semicolon. > >It isn't supposed to find this "error" as it is legal C. Walter Bright offers us PC-C'ers a worthwhile feature in the Zortech C preprocessor: if (condition); /* issues a warning */ if (condition) ; /* issues no warning */ Although this is of marginal usefulness in `if' statements, it's quite useful when using `for' or `while' statements with null operations to simply preset an index or to perform some operation which may be contained within the body of the `for' statement.