lint won't verify printf formatting against variable types??

Bob Stout Bob.Stout at p6.f506.n106.z1.fidonet.org
Tue Jul 4 18:20:45 AEST 1989


In an article of <28 Jun 89 08:32:33 GMT>, Goran Larsson writes:

 >In article <105 at borabora.omni.com> bob at 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. 



More information about the Comp.lang.c mailing list