Coding standards: don't use ``inline`` when defining a function in a class
authorDmitri Gribenko <gribozavr@gmail.com>
Mon, 4 Feb 2013 10:24:58 +0000 (10:24 +0000)
committerDmitri Gribenko <gribozavr@gmail.com>
Mon, 4 Feb 2013 10:24:58 +0000 (10:24 +0000)
definition

Current practice is not to use 'inline' in:

  class Foo {
  public:
    inline void bar() {
      // ...
    }
  };

llvm-svn: 174317

llvm/docs/CodingStandards.rst

index 74289a8..4d66ad7 100644 (file)
@@ -1088,6 +1088,34 @@ flushes the output stream.  In other words, these are equivalent:
 Most of the time, you probably have no reason to flush the output stream, so
 it's better to use a literal ``'\n'``.
 
+Don't use ``inline`` when defining a function in a class definition
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+A member function defined in a class definition is implicitly inline, so don't
+put the ``inline`` keyword in this case.
+
+Don't:
+
+.. code-block:: c++
+
+  class Foo {
+  public:
+    inline void bar() {
+      // ...
+    }
+  };
+
+Do:
+
+.. code-block:: c++
+
+  class Foo {
+  public:
+    void bar() {
+      // ...
+    }
+  };
+
 Microscopic Details
 -------------------