lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master f3e3434: Add a "Class Declarations" section t


From: Vadim Zeitlin
Subject: [lmi-commits] [lmi] master f3e3434: Add a "Class Declarations" section to the style guide
Date: Thu, 27 Sep 2018 16:57:03 -0400 (EDT)

branch: master
commit f3e3434e66100ea86898bb926817783312446251
Author: Vadim Zeitlin <address@hidden>
Commit: Vadim Zeitlin <address@hidden>

    Add a "Class Declarations" section to the style guide
    
    Document the order of the various parts in it.
---
 vz/Style-guide.md | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/vz/Style-guide.md b/vz/Style-guide.md
index fac71a5..b25fbcd 100644
--- a/vz/Style-guide.md
+++ b/vz/Style-guide.md
@@ -155,6 +155,39 @@ I.e. `1.0` instead of just `1.`.
 Semantic Rules
 ==============
 
+Class Declarations
+------------------
+
+### Put `friend` declarations at the top
+
+Also use elaborated-type-specifiers in the friend declarations:
+
+```cpp
+class X {
+    friend class Y; // Do use class keyword.
+
+public:
+    ...
+};
+```
+
+See 1930b4b0cf494341e3a3b571085ecf29002a2488.
+
+### Declare mutators before accessors
+
+Declare non-const functions before const functions in each of public and
+private sections. Withing each subsection, put higher level functions before
+the lower level ones.
+
+Rationale: accessors are generally less interesting, and often trivial; they
+get in the way unless they're grouped at the end.
+
+Also, use the same order for the definitions in the implementation file, as for
+the declarations.
+
+See f6390fe69a768246deba65e5bef18a9c2f462c14
+
+
 Miscellaneous
 -------------
 



reply via email to

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