[webkit-dev] [Coding Style] Clarification about multiple assignments on one line
Benjamin Poulain
benjamin at webkit.org
Fri Feb 22 14:50:45 PST 2013
On Fri, Feb 22, 2013 at 2:35 PM, Julien Chaffraix <jchaffraix at webkit.org>wrote:
>
> over several reviews, I have been saying that the following line is a
> coding style violation:
>
> firstVariable = secondVariable = 0;
>
> For a concrete example, the computePreferredLogicalWidths uses the
> following pattern:
>
> minWidth = maxWidth = max<int>(minWidth, tableLogicalWidth.value());
>
I personally prefer
maxWidth = max<int>(minWidth, tableLogicalWidth.value());
minWidth = maxWidth;
over:
minWidth = maxWidth = max<int>(minWidth, tableLogicalWidth.value());
The reason is simply that it is the style widely used today (and it is
easier to follow).
Like you, I believe this is already covered by "Each statement should get
its own line." in the style.
Cheers,
Benjamin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20130222/db1f9bb6/attachment.html>
More information about the webkit-dev
mailing list