Subject: Re: Style guide
To: None <current-users@NetBSD.ORG>
From: D'Arcy J.M. Cain <>
List: current-users
Date: 05/28/1997 14:58:23
Thus spake Chris G. Demetriou
> > 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
> The whole "nconsistent declaration of a global variable or function" thing.
> yes, _assuming consistent include files_, you should be safe, but the
> point is that it's hard to know that your program, libraries, etc.,
> were compiled with consistent includes files.  lint will tell you.

True, it also requires some amount of discipline but those flags do help
maintain that discipline quite easily.  For example, they force you to
have every function prototyped before it is called.  You can of course
prototype it locally but if you simply refuse to do so it won't happen
accidently and you will have to include the header that prototypes it.
They also require you to have a prototype before defining the function
so, in the same way, you are forced to include the header in the defining
module as well.  Yes, you need to ensure that the same header is included
both where a function is defined and everywhere it is used.  This usually
just means defining functions in only one header file.

And if some small discipline matters, you don't actually have to run lint to
compile a program.  With these flags I know that if a program compiled
then it has passed the checking program too since they are the same thing.

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