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

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 helpful.

    -- Darin

_______________________________________________
webkit-dev mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

Reply via email to