Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Unified Diff: styleguide/c++/c++11.html

Issue 1570443005: styleguide: Ban ref-qualified member functions, <atomic>, std::shared_ptr and std::initializer_list. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: specify who can approve ref-qualified member functions Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: styleguide/c++/c++11.html
diff --git a/styleguide/c++/c++11.html b/styleguide/c++/c++11.html
index 1e14b42dfc13c45950d2ec76afb2592358e30200..1c1f17b658018a78bc26c903d81688af3ff19ed7 100644
--- a/styleguide/c++/c++11.html
+++ b/styleguide/c++/c++11.html
@@ -548,6 +548,18 @@ string literal</a></td>
<td>Does not yet work in MSVS2013. Reevaluate once it does. <a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/gcoUbcjfsII">Discussion thread</a></td>
</tr>
+<tr>
+<td>Ref-qualified Member Functions</td>
+<td><code>class T {<br/>&nbsp;&nbsp;void f() & {}<br/>&nbsp;&nbsp;void f() && {}<br/>};<br/>t.f(); // first<br/>T().f(); // second<br/>std::move(t).f(); // second</code></td>
+<td>Allows class member functions to only bind to |this| as an rvalue or lvalue.</td>
+<td><a href="http://en.cppreference.com/w/cpp/language/member_functions">
+Member functions</a></td>
+<td>
+ Banned in the google3 C++11 library style guide. Banned in Chromium except by explicit approval from <code>styleguide/c++/OWNERS</code>.
+ <a href="https://groups.google.com/a/chromium.org/d/topic/cxx/gowclr2LPQA/discussion">Discussion Thread</a>
+</td>
+</tr>
+
</tbody>
</table>
@@ -591,6 +603,37 @@ string literal</a></td>
<td>C++11 has all kinds of classes for threads, mutexes, etc. Since we already have good code for this in <code>base/</code>, we should keep using the base classes, at least at first. <code>base::Thread</code> is tightly coupled to <code>MessageLoop</code> which would make it hard to replace. We should investigate using standard mutexes, or unique_lock, etc. to replace our locking/synchronization classes.</td>
</tr>
+<tr>
+<td>Atomics</td>
+<td><code>std::atomic</code> and others in <code>&lt;atomic&gt;</code></td>
+<td>Fine-grained atomic types and operations</td>
+<td><a href="http://en.cppreference.com/w/cpp/atomic">&lt;atomic&gt;</a></td>
+<td>Use in tcmalloc has caused <a href="http://crbug.com/572525">performance regressions</a>. Banned until we understand this better. <a href="https://groups.google.com/a/chromium.org/d/topic/cxx/Ej3RAiaI44s/discussion">Discussion Thread</a></td>
+</tr>
+
+<tr>
+<td>Shared Pointers</td>
+<td><code>std::shared_ptr</code></td>
+<td>Allows shared ownership of a pointer through reference counts</td>
+<td><a href="http://en.cppreference.com/w/cpp/memory/shared_ptr">std::shared_ptr</a></td>
+<td>
+ Needs a lot more evaluation for Chromium, and there isn't enough of a push for this feature.
+ <a href="https://groups.google.com/a/chromium.org/d/topic/cxx/aT2wsBLKvzI/discussion">Discussion Thread</a>,
+ <a href="https://google.github.io/styleguide/cppguide.html#Ownership_and_Smart_Pointers">Google Style Guide</a>
+</td>
+</tr>
+
+<tr>
+<td>Initializer Lists</td>
+<td><code>std::initializer_list&lt;T&gt;</code></td>
+<td>Allows containers to be initialized with aggregate elements</td>
+<td><a href="http://en.cppreference.com/w/cpp/utility/initializer_list"><code>std::initializer_list</code></a></td>
+<td>
+ Banned for now; will be re-evaluated once we switch to MSVC 2015.
+ <a href="https://groups.google.com/a/chromium.org/d/topic/cxx/TQQ-L51_naM/discussion">Discussion Thread</a>
+</td>
+</tr>
+
</tbody>
</table>
@@ -644,15 +687,6 @@ std::exception</a></td>
</tr>
<tr>
-<td>Ref-qualified Member Functions</td>
-<td><code>class T {<br/>&nbsp;&nbsp;void f() & {}<br/>&nbsp;&nbsp;void f() && {}<br/>};<br/>t.f(); // first<br/>T().f(); // second<br/>std::move(t).f(); // second</code></td>
-<td>Allows class member functions to only bind to |this| as an rvalue or lvalue.</td>
-<td><a href="http://en.cppreference.com/w/cpp/language/member_functions">
-Member functions</a></td>
-<td>Banned in the google3 C++11 library style guide, but being considered for use in bind/callback in google3 and the standard library.</td>
-</tr>
-
-<tr>
<td>Union Class Members</td>
<td><code>union <i>name</i> { <i>class</i> <i>var</i>}</code></td>
<td>Allows class type members</td>
@@ -724,14 +758,6 @@ std::allocator_traits</a></td>
</tr>
<tr>
-<td>Atomics</td>
-<td><code>std::atomic</code> and others in <code>&lt;atomic&gt;</code></td>
-<td>Fine-grained atomic types and operations</td>
-<td><a href="http://en.cppreference.com/w/cpp/atomic">&lt;atomic&gt;</a></td>
-<td></td>
-</tr>
-
-<tr>
<td>Bind Operations</td>
<td><code>std::bind(<i>function</i>, <i>args</i>, ...)</code></td>
<td>Declares a function object bound to certain arguments</td>
@@ -874,14 +900,6 @@ and <a href="http://en.cppreference.com/w/cpp/iterator/prev">std::prev</a>
</tr>
<tr>
-<td>Initializer Lists</td>
-<td><code>std::initializer_list&lt;T&gt;</code></td>
-<td>Allows containers to be initialized with aggregate elements</td>
-<td>TODO: documentation link</td>
-<td></td>
-</tr>
-
-<tr>
<td>Pointer Traits Class Template</td>
<td><code>std::pointer_traits</code></td>
<td>Provides a standard way to access properties
@@ -923,15 +941,6 @@ Reference Wrappers</a></td>
</tr>
<tr>
-<td>Shared Pointers</td>
-<td><code>std::shared_ptr</code></td>
-<td>Allows shared ownership of a pointer through reference counts</td>
-<td><a href="http://en.cppreference.com/w/cpp/memory/shared_ptr">std::shared_ptr</a></td>
-<td><a href="https://google.github.io/styleguide/cppguide.html#Ownership_and_Smart_Pointers">
-Ownership and Smart Pointers</a></td>
-</tr>
-
-<tr>
<td>Soft Program Exits</td>
<td><code>std::at_quick_exit()</code>
and <code>std::quick_exit()</code></td>
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698