Subject: Re: a new KNF (and some comments)
To: Simon Burge <simonb@NetBSD.ORG>
From: Jason Thorpe <thorpej@nas.nasa.gov>
List: tech-misc
Date: 01/21/2000 13:24:12
On Fri, 21 Jan 2000 13:15:34 +1100
Simon Burge <simonb@NetBSD.ORG> wrote:
> Can we put the "#ifndef lint" inside the __COPYRIGHT and __RCSID macros?
> It would be a little easier on the eyes...
In that case, you *definintely* need to nuke the ; from the soource files
and put it in the macro.
> > > /* No spaces after function names. */
> > > if (error = function(a1, a2))
> > > exit(error);
> >
> > That should read:
> >
> > if ((error = function(a1, a2)))
> >
> > but I personally prefer:
> >
> > if ((error = function(a1, a2)) != 0)
> >
> > ...for additional clarity.
>
> Doesn't one of the gcc warnings barf about "testing assignment value" or
> something? I think there are circumstances where you do need the "!= 0"
> bit to keep it happy.
My first sugggestion would make the compiler's warning generator happy,
but my second one is a little easier to read, I think.
-- Jason R. Thorpe <thorpej@nas.nasa.gov>