[llvm] r174317 - Coding standards: don't use ``inline`` when defining a function in a class

Dmitri Gribenko gribozavr at gmail.com
Mon Feb 4 02:24:58 PST 2013


Author: gribozavr
Date: Mon Feb  4 04:24:58 2013
New Revision: 174317

URL: http://llvm.org/viewvc/llvm-project?rev=174317&view=rev
Log:
Coding standards: don't use ``inline`` when defining a function in a class
definition

Current practice is not to use 'inline' in:

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

Modified:
    llvm/trunk/docs/CodingStandards.rst

Modified: llvm/trunk/docs/CodingStandards.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CodingStandards.rst?rev=174317&r1=174316&r2=174317&view=diff
==============================================================================
--- llvm/trunk/docs/CodingStandards.rst (original)
+++ llvm/trunk/docs/CodingStandards.rst Mon Feb  4 04:24:58 2013
@@ -1088,6 +1088,34 @@ flushes the output stream.  In other wor
 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
 -------------------
 





More information about the llvm-commits mailing list