Hi Stephan, On Fri, Nov 17, 2017 at 10:03:11AM +0100, Stephan Bergmann <sbergman@redhat.com> wrote:
Some random points regarding our recently introduced use of clang-format: * clang-format cannot automatically reformat code Most comments in the code are written by humans, for humans. They are often placed in a way that makes it technically unclear what code they pertain to, relying on humans to nevertheless easily discern that. For example, invoid f(int x) { g(x + 1); } // long comment explaining how g internally subtracts onethe comment clearly pertains to the call to g. Yet, clang-format will reformat this to something likevoid f(int x) { g(x + 1); } // long comment explaining how g internally subtracts oneinstead ofvoid f(int x) { g(x + 1); // long comment explaining how g internally subtracts one }thereby obscuring things. Always review automatically reformatted code for glitches like this.
Thanks for mentioning this. I also noticed something similar with initializer lists, where Foo::Foo() : foo(1), // foo bar(2) // bar { } gets reformatted to: Foo::Foo() : foo(1) , // foo bar(2) // bar { } but the ideal form is probably Foo::Foo() : foo(1) // foo , bar(2) // bar { } instead. Regards, Miklos
Attachment:
signature.asc
Description: Digital signature