gnu-c++-standards
[Top][All Lists]
Advanced

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

Re: Remind users about indentation conventions


From: Bruno Haible
Subject: Re: Remind users about indentation conventions
Date: Sun, 11 Aug 2019 14:12:41 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-157-generic; KDE/5.18.0; x86_64; ; )

Richard Stallman wrote:
> We should reaffirm the standard of putting the function name
> in a definition in column zero to help parse programs.

Agree. An argument that might convince these developers is that
it eases their own lives when working with git.

Test case: Make an edit to this file:
=============================== foo.cc ===============================
namespace foo {
int bar_unindented (int baz)
{
    statement1 ();
    statement2 ();
    statement3 ();
    statement4 ();
    statement5 ();
    statement6 ();
    statement7 ();
    statement8 ();
    statement9 ();
    statement10 ();
    statement11 ();
    statement12 ();
    statement13 ();
    statement14 ();
}
}






namespace foo {
    int bar_indented (int baz)
    {
        statement1 ();
        statement2 ();
        statement3 ();
        statement4 ();
        statement5 ();
        statement6 ();
        statement7 ();
        statement8 ();
        statement9 ();
        statement10 ();
        statement11 ();
        statement12 ();
        statement13 ();
        statement14 ();
    }
}

======================================================================

$ git diff foo.cc
diff --git a/foo.cc b/foo.cc
index a68b72eb9..1364475a6 100644
--- a/foo.cc
+++ b/foo.cc
@@ -14,7 +14,6 @@ int bar_unindented (int baz)
     statement11 ();
     statement12 ();
     statement13 ();
-    statement14 ();
 }
 }
 
@@ -39,7 +38,6 @@ namespace foo {
         statement11 ();
         statement12 ();
         statement13 ();
-        statement14 ();
     }
 }
 

Obviously what developers want to know is in which function the edit
occurred, not in which namespace.

Bruno




reply via email to

[Prev in Thread] Current Thread [Next in Thread]