Subject: Re: CVS commit: src/sys/kern
To: David Laight <david@l8s.co.uk>
From: Simon Burge <simonb@thistledown.com.au>
List: source-changes
Date: 09/07/2006 17:46:04
David Laight wrote:

> On Wed, Sep 06, 2006 at 08:01:25PM -0700, Garrett D'Amore wrote:
> > >
> > > Mark sizeof(tvp->tv_sec) check CONSTCOND.
> > > No space between the sizeof and the paren.
> ...
> > I still put space between sizeof and the paren out of habit -- its
> > Solaris. (Apparently because sizeof is a language keyword rather than a
> > function, it gets different spacing rules.)  Old habits die hard.
> 
> sizeof is actually an operator, not a function, so I always use either:
> 	sizeof variable
> or:
> 	sizeof (type)
> 
> 'sizeof(variable)' is almost as bad as 'return(value)'
> 
> 	David

Note that KNF says "Casts and sizeof's are not followed by a space." and
uses "malloc(sizeof(struct foo))" as an example.

Simon.