[webkit-dev] Bools are strictly worse than enums

Eric Seidel eric at webkit.org
Fri Dec 3 13:41:30 PST 2010


That would be so unbelievably fantastic!

On Fri, Dec 3, 2010 at 1:35 PM, David Levin <levin at google.com> wrote:

>
>
> On Fri, Dec 3, 2010 at 1:28 PM, Eric Seidel <eric at webkit.org> wrote:
>
>> It seems to me, that using bool types for function arguments is strictly
>> worse than using an enum.  An enum is always clearer and can be easily
>> casted to a bool if needed.
>>
>> doSomething(something, false);
>>
>> Is much less readable than:
>>
>> doSomething(something, AllowNetworkLoads);
>>
>>
>> Do any C++ gurus have further information to add here?  Is my (simple)
>> analysis here incorrect?  If not, seems we should forbid boolean values in
>> multi-argument methods/constructors in our style and add checks to
>> check-webkit-style
>>
>
> I'm pretty close to being able to do this in check-webkit-style. (I was
> actually working on something else.  Flagging unnecessary param names "void
> foo(ScriptExecutionContext* context);" because I get tired of mentioning
> this in code reviews.)
>
>
>> to prevent further introduction of these confusing callsites.
>>
>> -eric
>>
>> _______________________________________________
>> webkit-dev mailing list
>> webkit-dev at lists.webkit.org
>> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20101203/347a5ad9/attachment.html>


More information about the webkit-dev mailing list