Re: [webkit-dev] [Coding Style] Clarification about multiple assignments on one line
On Fri, Feb 22, 2013 at 2:35 PM, Julien Chaffraix wrote: > > over several reviews, I have been saying that the following line is a > coding style violation: > > firstVariable = secondVariable = 0; > That's what I've been doing as well. For a concrete example, the computePreferredLogicalWidths uses the > following pattern: > > minWidth = maxWidth = max(minWidth, tableLogicalWidth.value()); > > My justification is that those are 2 statements and thus should be on > 2 lines per "Each statement should get its own line.". That's my understanding. Some people consider that the previous rule doesn't apply to multiple > assignments on one line and that such code is fine by the book. > Strictly speaking, an assignment in C++ is an "expression" but I don't think that's our intention when we say "single statement per line". Preferring to the general concept of statement (e.g. see http://en.wikipedia.org/wiki/Statement_%28programming%29) in programming languages, an assignment is a statement. It then follows that our rule of *single statement per line* mandates each assignment to be on its own line. - R. Niwa ___ webkit-dev mailing list webkit-dev@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-dev
Re: [webkit-dev] [Coding Style] Clarification about multiple assignments on one line
On Fri, Feb 22, 2013 at 2:35 PM, Julien Chaffraix 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(minWidth, tableLogicalWidth.value()); > I personally prefer maxWidth = max(minWidth, tableLogicalWidth.value()); minWidth = maxWidth; over: minWidth = maxWidth = max(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 ___ webkit-dev mailing list webkit-dev@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-dev
Re: [webkit-dev] [Coding Style] Clarification about multiple assignments on one line
I have no objection to us using this compiler feature. On Fri, Feb 22, 2013 at 2:35 PM, Julien Chaffraix wrote: > Hi WebKit folks, > > 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(minWidth, tableLogicalWidth.value()); > > My justification is that those are 2 statements and thus should be on > 2 lines per "Each statement should get its own line.". Some people > consider that the previous rule doesn't apply to multiple assignments > on one line and that such code is fine by the book. > > What do people think? > > Thanks, > Julien > ___ > webkit-dev mailing list > webkit-dev@lists.webkit.org > https://lists.webkit.org/mailman/listinfo/webkit-dev > ___ webkit-dev mailing list webkit-dev@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-dev
[webkit-dev] [Coding Style] Clarification about multiple assignments on one line
Hi WebKit folks, 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(minWidth, tableLogicalWidth.value()); My justification is that those are 2 statements and thus should be on 2 lines per "Each statement should get its own line.". Some people consider that the previous rule doesn't apply to multiple assignments on one line and that such code is fine by the book. What do people think? Thanks, Julien ___ webkit-dev mailing list webkit-dev@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-dev
Re: [webkit-dev] About USE(CROSS_PLATFORM_CONTEXT_MENUS)
Hi again, It's been 2 days since the first email on this thread. Should I assume that no one is then relying on this USE flag? It adds quite a fair amount of code to all ContextMenu related files and I could clean that up if necessary. Cheers, jesus 2013/2/20 Jesus Sanchez-Palencia : > Hello, > > I was having a look at our Context Menu design when this USE flag got > my attention. Can someone help me clarify the motivation for it? It > seems that only PLATFORM(WIN) is using it, but I'm not sure if for > both WK1 and WK2... > > Also, is there any other port using it? > > Cheers, > jesus ___ webkit-dev mailing list webkit-dev@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-dev