[Users] Reformatting Carpet's source code

Erik Schnetter schnetter at cct.lsu.edu
Tue Jul 14 08:13:49 CDT 2015


On Tue, Jul 14, 2015 at 2:18 AM, Frank Loeffler <knarf at cct.lsu.edu> wrote:

> Hi
>
> On Fri, Jul 03, 2015 at 05:33:55PM -0400, Erik Schnetter wrote:
> > I propose to re-format Carpet's source code via clang-format.
>
> One question I couldn't find an easy answer for using Google: how often
> and how much does the default format style change?
>
> The reason I am asking is that if that happens, not only will we have
> users with different versions having the problem of back-and-forth
> only-format changes, we also will have to create a lot of 'update to
> format x' commits to avoid mixing them with real changes.
>
> The same would happen if we decide that the default isn't doing exactly
> what we want, and change it. (and I've seen a few examples I didn't like
> - just not yet some I would care enough about).
>
> Did anyone compare the available styles for C++, and how often _they_
> change?
>

clang-format knows different styles (LLVM, Google, Chromium, Mozilla,
WebKit), and of course you can define your own via .clang-format files,
usually using one of these four as starting point. I briefly looked at
them, and I found LLVM to be the closest to "usual" (dense) C++ formatting;
LLVM unsurprisingly also the default.

I agree that clang-format makes sometimes choices that I wouldn't make.
However, the resulting code is always very readable. And since the whole
point of using an automated formatter is that one doesn't have to care
about the style and fine-tune it, I decided to simply use the LLVM style
and forego the bikeshedding.

I don't think these styles change at all. I'm not aware of changes in the
past year. They have seen improvements to certain corner cases, or have
been extended to handle C++14 and now C++17 constructs, but I'm not aware
of any changes ("hey! let's change indentation from 2 to three 3 spaces!").

-erik

-- 
Erik Schnetter <schnetter at cct.lsu.edu>
http://www.perimeterinstitute.ca/personal/eschnetter/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.einsteintoolkit.org/pipermail/users/attachments/20150714/71be1482/attachment.html 


More information about the Users mailing list