[cfe-dev] clang-format and "ASCII art" formatting

Nico Weber thakis at chromium.org
Fri Dec 7 09:40:09 PST 2012


On Fri, Dec 7, 2012 at 8:18 AM, Daniel Jasper <djasper at google.com> wrote:
> Hi all,
>
> although I think we can make clang-format (clang/lib/Format) format more and
> more pieces of C++ according to a specific style, I am convinced that there
> are cases where automatic formatting is not the right solution.
>
> An example is:
> http://clang.llvm.org/doxygen/ParseExpr_8cpp-source.html line 60-90. Here,
> careful human thought leads to much more readable code then simply following
> a style guide.
>
> In order to handle such cases and still be able to auto-format entire files,
> I propose to add certain markers around areas of a file that clang-format
> should not touch.

In my opinion, the main advantage of an autoformatter is that its
output can be declared as canonical and that in organizations that do
that nobody needs to argue about indentation anymore. If you provide a
formatting escape hatch, you lose that property.

Nico

> Does anyone have thoughts on this? How would we best
> design this? Add special comments like "// NO clang-format {"?
>
> Cheers,
> Daniel
>
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>



More information about the cfe-dev mailing list