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

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

Issue 2932053002: Use C++11 alignment primitives (Closed)
Patch Set: Fix merge Created 3 years, 6 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 | « sandbox/linux/services/credentials.cc ('k') | third_party/WebKit/Source/platform/wtf/StdLibExtras.h » ('j') | 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 d62bf25703ae2f9452ca20261fe9d32938b95466..4fe82713de48f96f997d31bf354a6bcc89cdd231 100644
--- a/styleguide/c++/c++11.html
+++ b/styleguide/c++/c++11.html
@@ -78,6 +78,14 @@ change this file accordingly, linking to your discussion thread.</p>
</tr>
<tr>
+<td>Alignment Features</td>
+<td><code>alignas(alignof(T)) char[10];</code></td>
+<td>Specifies or queries storage alignment.</td>
+<td><a href="http://en.cppreference.com/w/chttp://en.cppreference.com/w/cpp/language/alignas">alignas</a>, <a href="http://en.cppreference.com/w/cpp/language/alignof">alignof</a></td>
+<td><code>alignof()</code> can be used. <code>alignas()</code> must be used with care because it does not interact well with export and packing specifiers. If your declaration contains any other attributes, use <code>ALIGNAS()</code> from <code>base/compiler_specific.h</code> instead. <a href="https://codereview.chromium.org/2670873002/">Patch where this was discussed</a></td>
+</tr>
+
+<tr>
<td>Angle Bracket Parsing in Templates</td>
<td><code>&gt;&gt;</code> for <code>&gt; &gt;</code>, <code>&lt;::</code> for <code>&lt; ::</code></td>
<td>More intuitive parsing of template parameters</td>
@@ -618,6 +626,13 @@ std::move(t).f();&nbsp;&nbsp;// second</code></td>
</tr>
<tr>
+<td>Aligned storage</td>
+<td><code>std::aligned_storage&lt;10, 128&gt;</code></td>
+<td>Uninitialized storage for objects requiring specific alignment.</td>
+<td><a href="http://en.cppreference.com/w/cpp/types/aligned_storage">std::aligned_storage</a></td>
+<td>MSVC 2017's implementation does not align on boundaries greater than sizeof(double) = 8 bytes. Use <code>alignas(128) char foo[10];</code> instead. <a href="https://codereview.chromium.org/2932053002">Patch where this was discovered</a>.</td>
+</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>
@@ -710,14 +725,6 @@ std::move(t).f();&nbsp;&nbsp;// second</code></td>
</tr>
<tr>
-<td>Alignment Features</td>
-<td><code>alignas</code> specifier, <code>alignof</code> operator</td>
-<td>Object alignment</td>
-<td><a href="http://en.cppreference.com/w/cpp/language/alignas">alignas specifier</a>, <a href="http://en.cppreference.com/w/cpp/language/alignof">alignof operator</a></td>
-<td>Reevaluate now that MSVS2015 is available. <a href="https://groups.google.com/a/chromium.org/forum/#!topic/cxx/rwXN02jzzq0">Discussion thread</a></td>
-</tr>
-
-<tr>
<td>Attributes</td>
<td><code>[[<i>attribute_name</i>]]</code></td>
<td>Attaches properties to declarations that specific compiler implementations may use.</td>
@@ -769,11 +776,10 @@ std::move(t).f();&nbsp;&nbsp;// second</code></td>
<tr>
<td>Aligned Storage</td>
-<td><code>std::aligned_storage&lt;Size, Align&gt;::type</code><br />
-<code>std::alignment_of&lt;T&gt;</code>, <code>std::aligned_union&lt;Size, ...Types&gt;</code> <code>std::max_align_t</code></td>
+<td><code>std::alignment_of&lt;T&gt;</code>, <code>std::aligned_union&lt;Size, ...Types&gt;</code> <code>std::max_align_t</code></td>
<td>Declare uninitialized storage having a specified alignment, or determine alignments.</td>
-<td><a href="http://en.cppreference.com/w/cpp/types/aligned_storage">std::aligned_storage</a></td>
-<td><code>std::aligned_storage</code> and <code>std::aligned_union</code> are disallowed in google3 over concerns about compatibility with internal cross-compiling toolchains.</td>
+<td><a href="http://en.cppreference.com/w/cpp/types/aligned_union">std::aligned_union</a></td>
+<td><code>std::aligned_union</code> is disallowed in google3 over concerns about compatibility with internal cross-compiling toolchains. <code>std::aligned_storage</code> is on the disallowed list due to compatibility concerns.</td>
</tr>
<tr>
« no previous file with comments | « sandbox/linux/services/credentials.cc ('k') | third_party/WebKit/Source/platform/wtf/StdLibExtras.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698