Bug #8610
closedcstyle should stop insisting on the whitespace after sizeof
0%
Description
no one except us insists on whitespace after sizeof, actually the other way round, may be we should stop as well?
Updated by Joshua M. Clulow almost 5 years ago
I think it's fine the way it is. It's an operator, not a function; the space reflects that visually.
Updated by Garrett D'Amore almost 5 years ago
I agree with Joshua. While it's unfortunate that our style is different than other styles, we have a style guide and a long history behind it. If we wanted to switch to a style supported by one or more of the BSDs to facilitate code exchange, then that is something that should be considered and done as a whole, rather than trying to sneak in minor changes like this that will only serve to make our own code base inconsistent with itself.
Updated by Yuri Pankov almost 5 years ago
It's not only BSDs, and the reason to not require a whitespace (IMO, of course) is that sizeof() is more function-like, returning value, not control operator, like for, while, or return.
And this is the only real style difference that I see as required by others -- yes, BSDs and those linux parts that actually care about style.
Updated by Marcel Telka almost 5 years ago
Actually, sizeof
is operator in a form of sizeof X
, where X
can be either variable, or type (or typecast, to be exact). For example, the following is valid C code:
size_t s; int a; s = sizeof a; s = sizeof (int);