Project

General

Profile

Bug #8610

cstyle should stop insisting on the whitespace after sizeof

Added by Yuri Pankov about 2 years ago. Updated about 2 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
Category:
tools - gate/build tools
Start date:
2017-09-05
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage

Description

no one except us insists on whitespace after sizeof, actually the other way round, may be we should stop as well?

History

#1

Updated by Joshua M. Clulow about 2 years ago

I think it's fine the way it is. It's an operator, not a function; the space reflects that visually.

#2

Updated by Garrett D'Amore about 2 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.

#3

Updated by Yuri Pankov about 2 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.

#4

Updated by Marcel Telka about 2 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);
#5

Updated by Yuri Pankov about 2 years ago

  • Status changed from New to Rejected

ok..

Also available in: Atom PDF