[webkit-dev] Should we ever change style guidelines?

Peter Kasting pkasting at google.com
Thu Dec 10 10:34:12 PST 2009


On Thu, Dec 10, 2009 at 7:57 AM, Joe Mason <jmason at rim.com> wrote:

> > Off the top of my head as a reviewer I'd accept:
> >
> >       if (color.red() == 255 && color.green() == 0 && color.blue() ==
> > 255) // pink!
> >
> > over
> >
> >       if (color.red() == 255 && !color.green() && color.blue() == 255)
> > // pink!
> >
> > most days of the week...  Consistency and all that.
>
> The actual potential bug in this comes when "if (!color.green())" comes
> on its own - it looks to a casual glance like green() returns a bool
> saying whether this color is green or not.


But if "!color.green()" is potentially confusing, then certainly it is just
as confusing (in fact moreso) without the surrounding "color.blue()" and
"color.red()" tests in Adam's example.  Yet Adam cited "consistency with
surroundings" as the reason to prefer == 0 in this case, which suggests that
he'd be fine with an isolated test of this value.

My point is that your argument (and Adam's) is not actually an argument for
reviewer discretion, or promoting consistency over whatever the style guide
says; it's an argument that the style guide is wrong to prefer "!foo" over
"foo == 0".

PK
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20091210/81c43f3c/attachment.html>


More information about the webkit-dev mailing list