[cfe-dev] clang-format chromium ternary operator

Peter Kasting pkasting at chromium.org
Mon Aug 12 14:07:09 PDT 2013


On Mon, Aug 12, 2013 at 1:57 PM, Daniel Jasper <djasper at google.com> wrote:

> Finally, regardless of all other arguments, and even ignoring the fact
>> that the above codesearch links included code they shouldn't: there's a way
>> of formatting these in Chromium code that is clearly more common even by a
>> pessimistic search, and is clearly compliant with the style guide.
>>  Therefore, the auto-formatter for Chromium code should use this pattern.
>>  It doesn't matter if your way is legal or not, the most important rule in
>> the whole style guide is "be consistent", which this does not do as well as
>> it could.
>>
>
> I understand your argument and it is perfectly valid. However, also
> consider other sorts of consistency: E.g. there are a lot of users that
> have to develop in both Chromium- and Google-style code. For them, any
> (unnecessary) inconsistency is harmful.
>

It seems clearly far more important that Chromium code be internally
consistent than that the formatter begin preferring a new, less-used style
over an existing, common, explicitly-valid style regardless of which way is
common in Google internal code.  This is true within other Google projects
as well.

I personally don't have any strong feelings about this (I for one would be
> happy with disallowing all multi-line conditional expressions). The
> decision to go this way is mostly that complex conditional expressions need
> as much structure as they can get. I know that we have other Chromium
> engineers that are happy enough with this. Is there a decision making
> process for Chromium style?
>

I don't see what "structure" you're buying with this style; it seems like
this:

aaaaa ?
    bbbbb :
    ccccc;

...is just as "structured" as what you're asking for, but aligns with the
common Chromium idiom.

If you are not willing to accept my argument on its face and simply make
this change, the next step is to escalate to chromium-dev.

But in the case where you "don't have any strong feelings" and I do, and
I've been working on the codebase for 7 years now, and you accept my
argument that the style I'm asking for is valid, I don't see what you gain
by doing so.

PK
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130812/5f1ac705/attachment.html>


More information about the cfe-dev mailing list