[Interest] 80 column enforcement under Linux

Matthew Woehlke mwoehlke.floss at gmail.com
Fri Jan 18 20:42:34 CET 2019


On 18/01/2019 13.54, Michael Jackson wrote:
> I would think that clang-format should be able to help you out with this. It is part of the LLVM download.

Ugh... clang-format...

Be warned: clang-format's version of line length enforcement is *very*
draconian. There is exactly one, and *only* one way to wrap a line (for
a given configuration, anyway¹). If you try to wrap a line differently,
because it improves readability... that's wrong, and clang-format will
"fix" it for you.

I can't recommend astyle, since it is basically dead, but please do
yourself a favor and also look at uncrustify, which is active and can be
configured to be far less rigid than clang-format while still enforcing
a line length limit.

(¹ Basically, clang-format supports "one item per line", "greedy", and
nothing in between². You can choose between them, but only globally, not
on a per-case basis.)

(² Pedantically, it also supports "leave it alone", but only if you turn
off line length enforcement, so that doesn't help you.)

-- 
Matthew



More information about the Interest mailing list