Member variables are now named like_this_

Fri, 17 Feb 2017 14:19:16 +0100

author
David Demelier <markand@malikania.fr>
date
Fri, 17 Feb 2017 14:19:16 +0100
changeset 8
d7cbb9a40f0d
parent 7
4fcd920b1a02
child 9
ee0ef058cb94

Member variables are now named like_this_

STYLE_CPP.md file | annotate | diff | comparison | revisions
--- a/STYLE_CPP.md	Fri Feb 17 14:16:14 2017 +0100
+++ b/STYLE_CPP.md	Fri Feb 17 14:19:16 2017 +0100
@@ -57,7 +57,7 @@
 ### Naming
 
   - English names,
-  - Member variables starts with `m_`,
+  - Member variables have trailing underscore (e.g foo\_bar\_),
   - No hungarian notation.
 
 Everything is in `underscore_case` except template parameters and macros.
@@ -70,12 +70,12 @@
 
     class object {
     private:
-        std::string m_name;
+        std::string name_;
 
     public:
         inline const std::string& name() const noexcept
         {
-            return m_name;
+            return name_;
         }
     };
 
@@ -215,9 +215,9 @@
 
     T& operator[](unsigned index)
     {
-        assert(index < m_length);
+        assert(index < length_);
 
-        return m_data[index];
+        return data_[index];
     }
 
 The `assert` macro is not meant to check that a function succeeded, this code
@@ -289,7 +289,7 @@
         };
 
     private:
-        int m_member{0};
+        int member_{0};
 
     public:
         void some_function();

mercurial