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

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: 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..ec256991380d7b3541534df177b012266e14e721 100644
--- a/styleguide/c++/c++11.html
+++ b/styleguide/c++/c++11.html
@@ -548,6 +548,15 @@ 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.</td>
Nico 2016/01/07 22:40:36 Can you add a Discussion thread link here?
jbroman 2016/01/07 23:26:32 Done.
+</tr>
+
</tbody>
</table>
@@ -591,6 +600,25 @@ 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://google.github.io/styleguide/cppguide.html#Ownership_and_Smart_Pointers">Ownership and Smart Pointers</a>
Nico 2016/01/07 22:40:36 Here too
jbroman 2016/01/07 23:26:32 Done.
+</td>
+</tr>
+
</tbody>
</table>
@@ -644,15 +672,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 +743,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>
@@ -923,15 +934,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