[webkit-dev] Bools are strictly worse than enums

Peter Kasting pkasting at chromium.org
Fri Dec 3 16:36:54 PST 2010

On Fri, Dec 3, 2010 at 2:42 PM, David Hyatt <hyatt at apple.com> wrote:

> An example of nice boolean usage is:
> paintTextWithShadows(context, font, textRun, 0, length, length,
> textOrigin, boxRect, textShadow, textStrokeWidth > 0, isHorizontal());
> The last parameter is a boolean indicating whether or not the text run is
> vertical text or horizontal text.  It would be unreadable if you passed raw
> true or raw false to the function, but all the call sites pass
> isHorizontal(), so it's perfectly fine.

Furthermore, the second-to-last arg here looks like a bool too, but
"textStrokeWidth > 0" seems a lot more obvious to a reader than "true".

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20101203/34ee81a4/attachment.html>

More information about the webkit-dev mailing list