Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/sys/kern



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.



Home | Main Index | Thread Index | Old Index