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

Daniel Jasper djasper at google.com
Mon Sep 15 10:08:33 PDT 2014


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?
>
> For clang-format to be useful as an adjunct to source-to-source
> transformation tools (i.e. refactoring tools), it needs to move
> towards supporting many varieties of formatting preferences, not just
> those mentioned in any style guide or used in any large project.
>
> For instance, to be useful in Visual Studio, a refactoring tool should
> support all the existing formatting options available in VS so that
> refactored code can conform to the user's formatting preferences and
> doesn't need to be reformatted again after refactoring.  (It's *way*
> too easy to introduce a subtle bug while manually reformatting code
> IMO.)
>
> 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. The sheer number of combinatory
options will make maintenance impossible. I'd rather support a much
narrower set of styles well instead of trying to make everybody happy and
failing. If that makes people change their style or else they can't use
automatic refactoring tools, I can live with that (I see the problem, but I
believe this to be the right direction).

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.

--
> "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>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140915/581fcd55/attachment.html>


More information about the cfe-dev mailing list