OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <!-- | 2 <!-- |
3 Copyright 2014 The Chromium Authors. All rights reserved. | 3 Copyright 2014 The Chromium Authors. All rights reserved. |
4 Use of this source code is governed by a BSD-style license that can be | 4 Use of this source code is governed by a BSD-style license that can be |
5 found in the LICENSE file. | 5 found in the LICENSE file. |
6 --> | 6 --> |
7 <html> | 7 <html> |
8 <head> | 8 <head> |
9 <meta charset="utf-8"> | 9 <meta charset="utf-8"> |
10 <title>C++11 use in Chromium</title> | 10 <title>C++11 use in Chromium</title> |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 | 71 |
72 <tr> | 72 <tr> |
73 <td>__func__ Local Variable</td> | 73 <td>__func__ Local Variable</td> |
74 <td><code>__func__</code></td> | 74 <td><code>__func__</code></td> |
75 <td>Provides a local variable containing the name of the enclosing function</td> | 75 <td>Provides a local variable containing the name of the enclosing function</td> |
76 <td><a href="http://en.cppreference.com/w/cpp/language/function#func">__func__</
a></td> | 76 <td><a href="http://en.cppreference.com/w/cpp/language/function#func">__func__</
a></td> |
77 <td>Use instead of the non-standard <code>__FUNCTION__</code>. <a href="https://
groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/ojGfcgSDzHM">Discuss
ion thread</a></td> | 77 <td>Use instead of the non-standard <code>__FUNCTION__</code>. <a href="https://
groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/ojGfcgSDzHM">Discuss
ion thread</a></td> |
78 </tr> | 78 </tr> |
79 | 79 |
80 <tr> | 80 <tr> |
| 81 <td>alignas / alignof</td> |
| 82 <td><code>alignas(alignof(T)) char[10];</code></td> |
| 83 <td>Queries or specifies storage alignment.</td> |
| 84 <td><a href="http://en.cppreference.com/w/chttp://en.cppreference.com/w/cpp/lang
uage/alignas">alignas</a>, <a href="http://en.cppreference.com/w/cpp/language/al
ignof">alignof</a></td> |
| 85 <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 y
our declaration contains any other attributes, use <code>ALIGNAS()</code> from <
code>base/compiler_specific.h</code> instead. <a href="https://codereview.chromi
um.org/2670873002/">Patch where this was discussed</a></td> |
| 86 </tr> |
| 87 |
| 88 <tr> |
81 <td>Angle Bracket Parsing in Templates</td> | 89 <td>Angle Bracket Parsing in Templates</td> |
82 <td><code>>></code> for <code>> ></code>, <code><::</code> for <c
ode>< ::</code></td> | 90 <td><code>>></code> for <code>> ></code>, <code><::</code> for <c
ode>< ::</code></td> |
83 <td>More intuitive parsing of template parameters</td> | 91 <td>More intuitive parsing of template parameters</td> |
84 <td><a href="http://stackoverflow.com/questions/15785496/c-templates-angle-brack
ets-pitfall-what-is-the-c11-fix">C++ templates angle brackets pitfall</a></td> | 92 <td><a href="http://stackoverflow.com/questions/15785496/c-templates-angle-brack
ets-pitfall-what-is-the-c11-fix">C++ templates angle brackets pitfall</a></td> |
85 <td>Recommended to increase readability. Approved without discussion.</td> | 93 <td>Recommended to increase readability. Approved without discussion.</td> |
86 </tr> | 94 </tr> |
87 | 95 |
88 <tr> | 96 <tr> |
89 <td>Arrays</td> | 97 <td>Arrays</td> |
90 <td><code>std::array</code></td> | 98 <td><code>std::array</code></td> |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 | 611 |
604 <tr> | 612 <tr> |
605 <th style='width:240px;'>Feature</th> | 613 <th style='width:240px;'>Feature</th> |
606 <th style='width:240px;'>Snippet</th> | 614 <th style='width:240px;'>Snippet</th> |
607 <th style='width:240px;'>Description</th> | 615 <th style='width:240px;'>Description</th> |
608 <th style='width:240px;'>Documentation Link</th> | 616 <th style='width:240px;'>Documentation Link</th> |
609 <th style='width:240px;'>Notes and Discussion Thread</th> | 617 <th style='width:240px;'>Notes and Discussion Thread</th> |
610 </tr> | 618 </tr> |
611 | 619 |
612 <tr> | 620 <tr> |
| 621 <td>Aligned storage</td> |
| 622 <td><code>std::aligned_storage<10, 128></code></td> |
| 623 <td>Uninitialized storage for objects requiring specific alignment.</td> |
| 624 <td><a href="http://en.cppreference.com/w/cpp/types/aligned_storage">std::aligne
d_storage</a></td> |
| 625 <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> |
| 626 </tr> |
| 627 |
| 628 <tr> |
613 <td>Atomics</td> | 629 <td>Atomics</td> |
614 <td><code><atomic></code></td> | 630 <td><code><atomic></code></td> |
615 <td>Fine-grained atomic types and operations</td> | 631 <td>Fine-grained atomic types and operations</td> |
616 <td><a href="http://en.cppreference.com/w/cpp/atomic">Atomic operations library<
/a></td> | 632 <td><a href="http://en.cppreference.com/w/cpp/atomic">Atomic operations library<
/a></td> |
617 <td>Use in tcmalloc has caused <a href="http://crbug.com/572525">performance reg
ressions</a>. Banned until we understand this better. <a href="https://groups.go
ogle.com/a/chromium.org/forum/#!topic/cxx/Ej3RAiaI44s">Discussion Thread</a></td
> | 633 <td>Use in tcmalloc has caused <a href="http://crbug.com/572525">performance reg
ressions</a>. Banned until we understand this better. <a href="https://groups.go
ogle.com/a/chromium.org/forum/#!topic/cxx/Ej3RAiaI44s">Discussion Thread</a></td
> |
618 </tr> | 634 </tr> |
619 | 635 |
620 <tr> | 636 <tr> |
621 <td>Bind Operations</td> | 637 <td>Bind Operations</td> |
622 <td><code>std::bind(<i>function</i>, <i>args</i>, ...)</code></td> | 638 <td><code>std::bind(<i>function</i>, <i>args</i>, ...)</code></td> |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
762 <tr> | 778 <tr> |
763 <td>Address Retrieval</td> | 779 <td>Address Retrieval</td> |
764 <td><code>std::addressof()</code></td> | 780 <td><code>std::addressof()</code></td> |
765 <td>Obtains the address of an object even with overloaded <code>operator&</c
ode></td> | 781 <td>Obtains the address of an object even with overloaded <code>operator&</c
ode></td> |
766 <td><a href="http://en.cppreference.com/w/cpp/memory/addressof">std::addressof</
a></td> | 782 <td><a href="http://en.cppreference.com/w/cpp/memory/addressof">std::addressof</
a></td> |
767 <td>Usage should be rare as <a href="https://google.github.io/styleguide/cppguid
e.html#Operator_Overloading">operator overloading</a> is rare and <code>&</c
ode> should suffice in most cases. May be preferable over <code>&</code> for
performing object identity checks.</td> | 783 <td>Usage should be rare as <a href="https://google.github.io/styleguide/cppguid
e.html#Operator_Overloading">operator overloading</a> is rare and <code>&</c
ode> should suffice in most cases. May be preferable over <code>&</code> for
performing object identity checks.</td> |
768 </tr> | 784 </tr> |
769 | 785 |
770 <tr> | 786 <tr> |
771 <td>Aligned Storage</td> | 787 <td>Aligned Storage</td> |
772 <td><code>std::aligned_storage<Size, Align>::type</code><br /> | 788 <td><code>std::alignment_of<T></code>, <code>std::aligned_union<Size, .
..Types></code> <code>std::max_align_t</code></td> |
773 <code>std::alignment_of<T></code>, <code>std::aligned_union<Size, ...Ty
pes></code> <code>std::max_align_t</code></td> | |
774 <td>Declare uninitialized storage having a specified alignment, or determine ali
gnments.</td> | 789 <td>Declare uninitialized storage having a specified alignment, or determine ali
gnments.</td> |
775 <td><a href="http://en.cppreference.com/w/cpp/types/aligned_storage">std::aligne
d_storage</a></td> | 790 <td><a href="http://en.cppreference.com/w/cpp/types/aligned_union">std::aligned_
union</a></td> |
776 <td><code>std::aligned_storage</code> and <code>std::aligned_union</code> are di
sallowed in google3 over concerns about compatibility with internal cross-compil
ing toolchains.</td> | 791 <td><code>std::aligned_union</code> is disallowed in google3 over concerns about
compatibility with internal cross-compiling toolchains. <code>std::aligned_stor
age</code> is on the disallowed list due to compatibility concerns.</td> |
777 </tr> | 792 </tr> |
778 | 793 |
779 <tr> | 794 <tr> |
780 <td>Allocator Traits</td> | 795 <td>Allocator Traits</td> |
781 <td><code>std::allocator_traits</code></td> | 796 <td><code>std::allocator_traits</code></td> |
782 <td>Provides an interface for accessing custom allocators</td> | 797 <td>Provides an interface for accessing custom allocators</td> |
783 <td><a href="http://en.cppreference.com/w/cpp/memory/allocator_traits">std::allo
cator_traits</a></td> | 798 <td><a href="http://en.cppreference.com/w/cpp/memory/allocator_traits">std::allo
cator_traits</a></td> |
784 <td>Usage should be rare.</td> | 799 <td>Usage should be rare.</td> |
785 </tr> | 800 </tr> |
786 | 801 |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
920 <td><a href="http://en.cppreference.com/w/cpp/locale/wstring_convert">std::wstri
ng_convert</a>, <a href="http://en.cppreference.com/w/cpp/locale/wbuffer_convert
">std::wbuffer_convert</a>, <a href="http://en.cppreference.com/w/cpp/locale/cod
ecvt_utf8">std::codecvt_utf8</a>, <a href="http://en.cppreference.com/w/cpp/loca
le/codecvt_utf16">std::codecvt_utf16</a>, <a href="http://en.cppreference.com/w/
cpp/locale/codecvt_utf8_utf16">std::codecvt_utf8_utf16</a></td> | 935 <td><a href="http://en.cppreference.com/w/cpp/locale/wstring_convert">std::wstri
ng_convert</a>, <a href="http://en.cppreference.com/w/cpp/locale/wbuffer_convert
">std::wbuffer_convert</a>, <a href="http://en.cppreference.com/w/cpp/locale/cod
ecvt_utf8">std::codecvt_utf8</a>, <a href="http://en.cppreference.com/w/cpp/loca
le/codecvt_utf16">std::codecvt_utf16</a>, <a href="http://en.cppreference.com/w/
cpp/locale/codecvt_utf8_utf16">std::codecvt_utf8_utf16</a></td> |
921 <td>Non-UTF-8 text is banned by the <a href="https://google.github.io/styleguide
/cppguide.html#Non-ASCII_Characters">Google Style Guide</a>. However, may be use
ful for consuming non-ASCII data.</td> | 936 <td>Non-UTF-8 text is banned by the <a href="https://google.github.io/styleguide
/cppguide.html#Non-ASCII_Characters">Google Style Guide</a>. However, may be use
ful for consuming non-ASCII data.</td> |
922 </tr> | 937 </tr> |
923 | 938 |
924 </tbody> | 939 </tbody> |
925 </table> | 940 </table> |
926 | 941 |
927 </div> | 942 </div> |
928 </body> | 943 </body> |
929 </html> | 944 </html> |
OLD | NEW |