[webkit-dev] unwritten rules of webkit style
darin at apple.com
Wed Sep 2 10:01:41 PDT 2009
On Sep 2, 2009, at 10:00 AM, Alexey Proskuryakov wrote:
> 02.09.2009, в 9:54, David Levin написал(а):
>>> Use enums instead of bools for parameters. The one exception is
>>> function names that start with "set" and take one parameter (e.g.
>> The purpose of this rule is to avoid having illegible function
>> calls like doSomething(myData, true, 0, false, true). If a function
>> is always called with a named variable, there is no practical
>> reason to invent an enum for it.
>> Yes, this is a C/C++ rule. I do Objective C so seldom that I
>> didn't think about that, but the guideline should mention that.
> I actually meant named variable as in doSomething(myData,
> m_memberBool1, 0, m_memberBool2, localBool). If these have
> meaningful names (as they should), there is no problem at all with
> this call site.
This is the same thing I was getting at with my comment.
The named enums guideline is only appropriate for function arguments
where callers will be passing boolean constants such as true or false.
When they are passing boolean expressions instead, the enum is not
More information about the webkit-dev