Source-Changes-D archive

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

Re: CVS commit: src/usr.bin/xlint



> 
> There are several forms of writing sizeof:
> 
> 1. sizeof expr
> 2. sizeof(expr)
> 3. sizeof (expr)
> 4. sizeof(type)
> 5. sizeof (type)
> 
> I thought that the point of the rule you cited was to discourage forms 3
> and 5.  Does the rule also discourage form 1, and if so, why?
> 
> To me, writing 'sizeof expr' is clearer than 'sizeof(expr)' since
> 'sizeof' is not a function, same as with 'return'.
> 
> Did I misinterpret the style guide in this regard?

I think that this (no space after sizeof) is an unindented
effect of the rule (preventing sizeof x).

Having said that, most of the code uses sizeof(x) instead of sizeof x
so I typically follow suit for consistency. Nevertheless we should mention
what is the preferred style and document it clearly.

christos

Attachment: signature.asc
Description: Message signed with OpenPGP



Home | Main Index | Thread Index | Old Index