Re: clang-format syntax

Den 2016-02-24 kl. 22:00, skrev Murray Cumming:
On Sun, 2016-02-14 at 17:15 +0100, Kjell Ahlstedt wrote:
This is my proposal:

  BasedOnStyle: Mozilla
  Standard: Cpp11
  AlignAfterOpenBracket: false
  AlignEscapedNewlinesLeft: true
  AlwaysBreakAfterDefinitionReturnType: None
  BreakBeforeBraces: Allman
  ColumnLimit: 100
  IndentCaseLabels: false

The differences from your patch is that I've added

  AlignEscapedNewlinesLeft: true
  AlwaysBreakAfterDefinitionReturnType: None
  ColumnLimit: 100
  IndentCaseLabels: false

and removed

  SpaceBeforeParens: Never

These differences are not important to me. I can accept most
formatting rules. Consistent formatting is important, but the exact
rules are not.
OK. That's fine.

I wonder if we can avoid the odd comma placement here:

-: m_RunButton("Run"),
-  m_TextWidget_Info(false),
-  m_TextWidget_Source(true)
+  : m_RunButton("Run")
+  , m_TextWidget_Info(false)
+  , m_TextWidget_Source(true)

And I prefer the : without the indent, but I guess it's not that
  BreakConstructorInitializersBeforeComma: false
  ConstructorInitializerAllOnOneLineOrOnePerLine: true
  ConstructorInitializerIndentWidth: 0

And I would like the second line here to be indented:

+      list_file.push_back( MenuElem("_New", "<control>N",
+    &Example_AppWindow::on_menu_item)) );

Those lines are part of a multi-line comment with too long lines. It's formatted differently if it's not a comment.

+    list_file.push_back(
+      MenuElem("_New", "<control>N", sigc::mem_fun(*this, &Example_AppWindow::on_menu_item)));

This is not ideal:

   //                              left  top  width  height
-  m_Grid.attach(m_ScrolledWindow, 0,    2,   1,     1);
+  m_Grid.attach(m_ScrolledWindow, 0, 2, 1, 1);

It can be avoided with extra comments:

+    // clang-format off
     //                       left  top  width  height
     m_Grid.attach(m_Toolbar, 0,    1,   1,     1);
+    // clang-format on

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]