On Fri, Dec 3, 2010 at 1:28 PM, Eric Seidel <e...@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); >
I agree that in general, the latter is better. Do any C++ gurus have further information to add here? > Restricting bools can limit your ability to pass results of one function as arguments to another. It is plausible to have function A return a different "enumerated boolean" type than function B takes, for example, if one type is a special-case of the other. This means you'll need to add explicit ?: ops, conditionals, or casts, all of which make me more unhappy than the original bools did. This is probably an issue in a minority of cases, but it might be reason to use "should" rather than "must" language here. PK
_______________________________________________ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev