[webkit-dev] unwritten rules of webkit style

Alexey Proskuryakov ap at webkit.org
Wed Sep 2 10:00:13 PDT 2009


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.  
>> setAllowHeaders).
>
> 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.

It's true that Objective-C doesn't have this problem, other than for  
plain C functions.

- WBR, Alexey Proskuryakov



More information about the webkit-dev mailing list