[cfe-dev] clang-format: Proposal for a new style for constructor and initializers line break.

Richard legalize at xmission.com
Mon Sep 15 12:17:55 PDT 2014


In article <CAK_tg0wGyXx1p+1ng2sHuAkH5doqd1Lmf=-1PBrG_kY2rAD0yg at mail.gmail.com>,
    Daniel Jasper <djasper at google.com> writes:

> On Mon, Sep 15, 2014 at 6:46 PM, Richard <legalize at xmission.com> wrote:
> 
> >
> > In article <
> > CAK_tg0xYoOtEuHc3jaFO7-xF_hyTGFR+4D-+xK4MbNa9F6ZavA at mail.gmail.com>,
> >     Daniel Jasper <djasper at google.com> writes:
> >
> > > Is this style used in any large project or widely used style guide?
> >
> > Daniel, did you raise this issue as a means of prioritizing changes to
> > clang-format, or did you mean to imply that clang-format should not
> > become as feature rich as the set of options provided by Visual Studio?
> >
> 
> Both. Prioritizing styles that are used in large open-source projects is
> obvious.
> 
> However, we simply cannot support any single format option that another
> formatter/IDE has chosen to be valuable.

I think it is reasonable to say that clang-format should be able to
format code according to the default settings of popular IDEs.  Surely,
those fall into the "widely used style" category.  (For me, this means:
VS, Xcode, and Eclipse CDT, but I can become convinced that more IDEs
should be added to that list.)

In my experience, your average developer adapts more to the default
formatting provided by their IDE than they adapt the IDE to their
preferred formatting.

> Now, there is a decision to make for each style option. As a rough
> guideline, an option is acceptable if:
> - It is trivial.
> - Somebody is willing to contribute a patch complete with tests and
> maintain it.
> - The option is necessary for a widely used open style guide, in which case
> the core clang-format team will eventually put in the time and implement it.

Yes, my thinking was that "if you want more fancy formatting options,
you should be willing to pay for them." as in your 2nd option listed
above.  I say this as someone for whom the existing styles and
options provided by clang-format don't make me want to run my code
through it ;-).

I would love to see clang-format being so awesome that every refactoring
tool developer just uses it without thinking twice.  What we have is a
great start, but we're not there yet IMO.
-- 
"The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline>
     The Computer Graphics Museum <http://ComputerGraphicsMuseum.org>
         The Terminals Wiki <http://terminals.classiccmp.org>
  Legalize Adulthood! (my blog) <http://LegalizeAdulthood.wordpress.com>



More information about the cfe-dev mailing list