Subject: Re: [boost] clang-format file
From: Daniel Frey (d.frey_at_[hidden])
Date: 2018-01-22 23:03:12
> On 22. Jan 2018, at 21:00, Michael Caisse via Boost <boost_at_[hidden]> wrote:
> *Please* do not mess up the source code. Some of us believe that there
> is an art involved to writing beautiful code. The white space formatting
> of heavy template code, macros, and EDSL's makes the code understandable
> to humans.
> Clang-format and other such tools destroy readability and understanding
> in many code bases. Don't believe me? Take a look at well written Proto,
> Spirit, MSM, or MPL/Fusion heavy sources written by someone who believes
> that code should be beautiful. Now run it through your favorite
> format-tool and observe the horrible mess that emerges.
While I agree in general, there are also ways to have both. In our little project, we decided to have a consistent and automated style, enforced by clang-format. But there are sections of code which are hand-formatted, you can simply augment them with comments to turn clang-format off and later on again. As an example, see <https://github.com/taocpp/PEGTL/blob/master/src/example/pegtl/unescape.cpp>.
Nevertheless, reformatting all of Boost seems like a terrible idea right now. It might be an option for those libraries/maintainers that want to use a consistent style in the future and stop debating over it, still having the possibility to exclude some sections from auto-formatting. Regardless, someone has to come up with an agreeable style first anyways...
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk