Subject: Re: Style guide
To: None <current-users@NetBSD.ORG>
From: D'Arcy J.M. Cain <darcy@druid.net>
List: current-users
Date: 05/28/1997 13:33:41
Thus spake Johan Danielsson
> John Nemeth <jnemeth@cue.bc.ca> writes:
> > Besides, lint does a better job of finding problems then any
> > compiler I've ever seen (including gcc).
> 
> And you never find code like this?
> 
> #ifdef lint
>   i = i;
> #endif
> 
> or
> 
> #ifndef lint
>  a lot of code that breaks with lint
> #endif

A related issue is the fact that with lint you are checking the code
with a different tool in a different environment.  That's why I tend
to eschew lint in favour of compiling with this:


CFLAGS = -O2 -pipe -ansi -Wall -Wshadow -Wpointer-arith -Wcast-qual \
         -Wwrite-strings -Werror -Wstrict-prototypes -Wmissing-prototypes \
         -funsigned-char -Dscanf=DONT_USE_SCANF -Dgets=DONT_USE_GETS

This catches just about any error that lint will and probably some that
lint won't.  In addition, the tool that does the compile is the tool that
does the checking and it does it under the exact same conditions.  Passing
this test makes me more comfortable than passing lint.

-- 
D'Arcy J.M. Cain                           |  Democracy is three wolves
darcy@{druid.net|vex.net}                  |  and a sheep voting on         
+1 416 424 2871     (DoD#0082)    (eNTP)   |  what's for dinner.
                --  http://www.druid.net/darcy  --