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 <link rel="stylesheet" href="c++11.css"> | 10 <link rel="stylesheet" href="c++11.css"> |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
59 <td>Angle Bracket Parsing in Templates</td> | 59 <td>Angle Bracket Parsing in Templates</td> |
60 <td><code>>></code> for <code>> ></code> and <br /> | 60 <td><code>>></code> for <code>> ></code> and <br /> |
61 <code><::</code> for <code>< ::</code></td> | 61 <code><::</code> for <code>< ::</code></td> |
62 <td>More intuitive parsing of template parameters</td> | 62 <td>More intuitive parsing of template parameters</td> |
63 <td><a href="http://stackoverflow.com/questions/15785496/c-templates-angle-brack ets-pitfall-what-is-the-c11-fix"> | 63 <td><a href="http://stackoverflow.com/questions/15785496/c-templates-angle-brack ets-pitfall-what-is-the-c11-fix"> |
64 C++ Templates Angle Brackets Pitfall</a></td> | 64 C++ Templates Angle Brackets Pitfall</a></td> |
65 <td>Recommended to increase readability. Approved without discussion.</td> | 65 <td>Recommended to increase readability. Approved without discussion.</td> |
66 </tr> | 66 </tr> |
67 | 67 |
68 <tr> | 68 <tr> |
69 <td>Automatic Types</td> | |
70 <td><code>auto</code></td> | |
71 <td>Automatic type deduction</td> | |
72 <td>TODO: documentation link</td> | |
73 <td>Use according to the <a | |
74 href="https://google-styleguide.googlecode.com/svn/trunk/cppguide.html#auto">Goo gle | |
75 Style Guide on <code>auto</code></a>. <a href="https://groups.google.com/a/chrom ium.org/forum/#!topic/chromium-dev/OQyYSfH9m2M">Discussion thread</a></td> | |
76 </tr> | |
77 | |
78 <tr> | |
69 <td>Final Specifier</td> | 79 <td>Final Specifier</td> |
70 <td><code>final</code></td> | 80 <td><code>final</code></td> |
71 <td> Indicates that a class or function is final and cannot be overridden</td> | 81 <td> Indicates that a class or function is final and cannot be overridden</td> |
72 <td><a href="http://en.cppreference.com/w/cpp/language/final">final Language Ref erence</a></td> | 82 <td><a href="http://en.cppreference.com/w/cpp/language/final">final Language Ref erence</a></td> |
73 <td>Recommended for new code. Existing uses of the <code>FINAL</code> macro will be <a href="https://crbug.com/417463">replaced throughout the codebase</a>. <a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/VTNZzi zN0zo">Discussion thread</a></td> | 83 <td>Recommended for new code. Existing uses of the <code>FINAL</code> macro will be <a href="https://crbug.com/417463">replaced throughout the codebase</a>. <a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/VTNZzi zN0zo">Discussion thread</a></td> |
74 </tr> | 84 </tr> |
75 | 85 |
76 <tr> | 86 <tr> |
77 <td>Local Types as Template Arguments</td> | 87 <td>Local Types as Template Arguments</td> |
78 <td></td> | 88 <td></td> |
(...skipping 17 matching lines...) Expand all Loading... | |
96 | 106 |
97 <tr> | 107 <tr> |
98 <td>Override Specifier</td> | 108 <td>Override Specifier</td> |
99 <td><code>override</code></td> | 109 <td><code>override</code></td> |
100 <td>Indicates that a class or function overrides a base implementation</td> | 110 <td>Indicates that a class or function overrides a base implementation</td> |
101 <td><a href="http://en.cppreference.com/w/cpp/language/override">override Langua ge Reference</a></td> | 111 <td><a href="http://en.cppreference.com/w/cpp/language/override">override Langua ge Reference</a></td> |
102 <td>Recommended for new code. Existing uses of the <code>OVERRIDE</code> macro w ill be <a href="https://crbug.com/417463">replaced throughout the codebase</a>. <a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/VTN ZzizN0zo">Discussion</a></td> | 112 <td>Recommended for new code. Existing uses of the <code>OVERRIDE</code> macro w ill be <a href="https://crbug.com/417463">replaced throughout the codebase</a>. <a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/VTN ZzizN0zo">Discussion</a></td> |
103 </tr> | 113 </tr> |
104 | 114 |
105 <tr> | 115 <tr> |
116 <td>Range-Based For Loops</td> | |
117 <td><code>for (<i>type</i> <i>var</i> : <i>range</i>)</code></td> | |
118 <td>Facilitates a more concise syntax for iterating over the elements | |
119 of a container (or a range of iterators) in a <code>for</code> loop</td> | |
120 <td>TODO: documentation link</td> | |
121 <td>As a rule of thumb, use <code>for (const auto& ...)</code>, <code>for (auto& ...)</code>, or <code>for (<i>concrete type</i> ...)</code>. For pointers, use <code>for (auto* ...)</code> to make clear that the copy of the loop variable is intended, and only a pointer is copied. <a href="https://groups.google.com/a/ch romium.org/forum/#!topic/chromium-dev/hpzz4EqbVmc">Discussion thread</a></td> | |
Nico
2014/09/25 18:42:55
(The pointer thing is from http://llvm.org/docs/Co
| |
122 </tr> | |
123 | |
124 <tr> | |
106 <td>Standard Integers</td> | 125 <td>Standard Integers</td> |
107 <td>Typedefs within <code><stdint.h></code> | 126 <td>Typedefs within <code><stdint.h></code> |
108 and <code><inttypes></code></td> | 127 and <code><inttypes></code></td> |
109 <td>Provides fixed-size integers independent of platforms</td> | 128 <td>Provides fixed-size integers independent of platforms</td> |
110 <td><a href="http://www.cplusplus.com/reference/cstdint/"> | 129 <td><a href="http://www.cplusplus.com/reference/cstdint/"> |
111 <stdint.h> (cstdint)</a></td> | 130 <stdint.h> (cstdint)</a></td> |
112 <td>Already in common use in the codebase. Approved without discussion.</td> | 131 <td>Already in common use in the codebase. Approved without discussion.</td> |
113 </tr> | 132 </tr> |
114 | 133 |
134 <tr> | |
135 <td>Static Assertions</td> | |
136 <td><code>static_assert(<i>bool</i>, <i>string</i>)</code></td> | |
137 <td>Tests compile-time conditions</td> | |
138 <td><a href="http://en.cppreference.com/w/cpp/language/static_assert">Static Ass ertion</a></td> | |
139 <td><a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev /POISBQEhGzU">Discussion thread</a></td> | |
140 </tr> | |
141 | |
142 <tr> | |
143 <td>Variadic Macros</td> | |
144 <td><code>#define <i>MACRO</i>(...) <i>Impl</i>(<i>args</i>, __VA_ARGS__)</code> </td> | |
145 <td>Allows macros that accept a variable number of arguments</td> | |
146 <td><a href="http://stackoverflow.com/questions/4786649/are-variadic-macros-nons tandard"> | |
147 Are Variadic macros nonstandard?</a></td> | |
148 <td>Usage should be rare. <a href="https://groups.google.com/a/chromium.org/foru m/#!topic/chromium-dev/sRx9j3CQqyA">Discussion thread</a></td> | |
149 </tr> | |
150 | |
151 <tr> | |
152 <td>Variadic Templates</td> | |
153 <td><code>template <<i>typename</i> ... <i>arg</i>></code></td> | |
154 <td>Allows templates that accept a variable number of arguments</td> | |
155 <td>TODO: documentation link</td> | |
156 <td>Usage should be rare. Use instead of .pump files.<a href="https://groups.goo gle.com/a/chromium.org/forum/#!topic/chromium-dev/6ItymeMXpMc">Discussion thread </a></td> | |
157 </tr> | |
158 | |
115 </tbody> | 159 </tbody> |
116 </table> | 160 </table> |
117 | 161 |
118 <h2 id="blacklist">C++11 Blacklist (Disallowed and Banned Features)</h2> | 162 <h2 id="blacklist">C++11 Blacklist (Disallowed and Banned Features)</h2> |
119 | 163 |
120 <p>This section lists features that are not allowed to be used yet. | 164 <p>This section lists features that are not allowed to be used yet. |
121 | 165 |
122 <h3 id="blacklist_banned">C++11 Banned Features</h3> | 166 <h3 id="blacklist_banned">C++11 Banned Features</h3> |
123 | 167 |
124 <p>This section will list C++11 features that are not allowed in the Chromium | 168 <p>This section will list C++11 features that are not allowed in the Chromium |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
225 <td>Attributes</td> | 269 <td>Attributes</td> |
226 <td><code>[[<i>attribute_name</i>]]</code></td> | 270 <td><code>[[<i>attribute_name</i>]]</code></td> |
227 <td>Attaches properties to declarations that | 271 <td>Attaches properties to declarations that |
228 specific compiler implementations may use.</td> | 272 specific compiler implementations may use.</td> |
229 <td><a href="http://www.codesynthesis.com/~boris/blog/2012/04/18/cxx11-generaliz ed-attributes/"> | 273 <td><a href="http://www.codesynthesis.com/~boris/blog/2012/04/18/cxx11-generaliz ed-attributes/"> |
230 C++11 generalized attributes</a></td> | 274 C++11 generalized attributes</a></td> |
231 <td></td> | 275 <td></td> |
232 </tr> | 276 </tr> |
233 | 277 |
234 <tr> | 278 <tr> |
235 <td>Automatic Types</td> | |
236 <td><code>auto</code></td> | |
237 <td>Automatic type deduction</td> | |
238 <td>TODO: documentation link</td> | |
239 <td><a | |
240 href="https://google-styleguide.googlecode.com/svn/trunk/cppguide.html#auto">Goo gle | |
241 Style Guide on <code>auto</code></a></td> | |
242 </tr> | |
243 | |
244 <tr> | |
245 <td>Declared Type Accessor</td> | 279 <td>Declared Type Accessor</td> |
246 <td><code>decltype(<i>expression</i>)</code></td> | 280 <td><code>decltype(<i>expression</i>)</code></td> |
247 <td>Provides a means to determine the type of an expression at compile-time, | 281 <td>Provides a means to determine the type of an expression at compile-time, |
248 useful most often in templates.</td> | 282 useful most often in templates.</td> |
249 <td><a href="http://en.cppreference.com/w/cpp/language/decltype"> | 283 <td><a href="http://en.cppreference.com/w/cpp/language/decltype"> |
250 decltype specifier</a></td> | 284 decltype specifier</a></td> |
251 <td><a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev /_zoNvZd_dSo">Discussion thread</a></td> | 285 <td><a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev /_zoNvZd_dSo">Discussion thread</a></td> |
252 </tr> | 286 </tr> |
253 | 287 |
254 <tr> | 288 <tr> |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
312 explicit specifier</a></td> | 346 explicit specifier</a></td> |
313 <td></td> | 347 <td></td> |
314 </tr> | 348 </tr> |
315 | 349 |
316 <tr> | 350 <tr> |
317 <td>Function Suppression</td> | 351 <td>Function Suppression</td> |
318 <td><code><i>Function</i>(<i>arguments</i>) = delete;</code></td> | 352 <td><code><i>Function</i>(<i>arguments</i>) = delete;</code></td> |
319 <td>Suppresses the implementation of a function, especially a | 353 <td>Suppresses the implementation of a function, especially a |
320 synthetic function such as a copy constructor</td> | 354 synthetic function such as a copy constructor</td> |
321 <td>TODO: documentation link</td> | 355 <td>TODO: documentation link</td> |
322 <td></td> | 356 <td><a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev /i1o7-RNRnMs">Discussion thread</a></td> |
323 </tr> | 357 </tr> |
324 | 358 |
325 <tr> | 359 <tr> |
326 <td>(Uniform) Initialization Syntax</td> | 360 <td>(Uniform) Initialization Syntax</td> |
327 <td><code><i>type</i> <i>name</i> { [<i>value</i> ..., <i>value</i>]};</code></t d> | 361 <td><code><i>type</i> <i>name</i> { [<i>value</i> ..., <i>value</i>]};</code></t d> |
328 <td>Allows any object of primitive, aggregate or class | 362 <td>Allows any object of primitive, aggregate or class |
329 type to be initialized using brace syntax</td> | 363 type to be initialized using brace syntax</td> |
330 <td>TODO: documentation link</td> | 364 <td>TODO: documentation link</td> |
331 <td><a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev /GF96FshwHLw">Discussion thread</a></td> | 365 <td><a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev /GF96FshwHLw">Discussion thread</a></td> |
332 </tr> | 366 </tr> |
333 | 367 |
334 <tr> | 368 <tr> |
335 <td>Inline Namespaces</td> | 369 <td>Inline Namespaces</td> |
336 <td><code>inline</code></td> | 370 <td><code>inline</code></td> |
337 <td>Allows better versioning of namespaces</td> | 371 <td>Allows better versioning of namespaces</td> |
338 <td><a href="http://en.cppreference.com/w/cpp/language/namespace">Namespaces</a> </td> | 372 <td><a href="http://en.cppreference.com/w/cpp/language/namespace">Namespaces</a> </td> |
339 <td>Under investigation, unclear how it will work with | 373 <td>Unclear how it will work with components</td> |
340 components</td> | |
341 </tr> | 374 </tr> |
342 | 375 |
343 <tr> | 376 <tr> |
344 <td>Lambda Expressions</td> | 377 <td>Lambda Expressions</td> |
345 <td><code>[<i>captures</i>](<i>params</i>) -> <i>ret</i> { <i>body</i> }</cod e></td> | 378 <td><code>[<i>captures</i>](<i>params</i>) -> <i>ret</i> { <i>body</i> }</cod e></td> |
346 <td>Anonymous functions</td> | 379 <td>Anonymous functions</td> |
347 <td><a href="http://en.cppreference.com/w/cpp/language/lambda">Lambda functions< /a></td> | 380 <td><a href="http://en.cppreference.com/w/cpp/language/lambda">Lambda functions< /a></td> |
348 <td>No default captures (<a href="https://google-styleguide.googlecode.com/svn/t runk/cppguide.html#Lambda_expressions">Google Style Guide</a>). <a href="https:/ /groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/D9UnnxBnciQ">Discus sion thread</a></td> | 381 <td>No default captures (<a href="https://google-styleguide.googlecode.com/svn/t runk/cppguide.html#Lambda_expressions">Google Style Guide</a>). <a href="https:/ /groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/D9UnnxBnciQ">Discus sion thread</a></td> |
349 </tr> | 382 </tr> |
350 | 383 |
(...skipping 10 matching lines...) Expand all Loading... | |
361 <td>Non-Static Class Member Initializers</td> | 394 <td>Non-Static Class Member Initializers</td> |
362 <td> | 395 <td> |
363 <code> | 396 <code> |
364 class C {<br /> | 397 class C {<br /> |
365 <i>type</i> <i>var</i> = <i>value</i>;<br/> | 398 <i>type</i> <i>var</i> = <i>value</i>;<br/> |
366 C() // copy-initializes <i>var</i><br/> | 399 C() // copy-initializes <i>var</i><br/> |
367 </code> | 400 </code> |
368 <td>Allows non-static class members to be initialized at their definitions (outs ide constructors)</td> | 401 <td>Allows non-static class members to be initialized at their definitions (outs ide constructors)</td> |
369 <td><a href="http://en.cppreference.com/w/cpp/language/data_members"> | 402 <td><a href="http://en.cppreference.com/w/cpp/language/data_members"> |
370 Non-static data members</a></td> | 403 Non-static data members</a></td> |
371 <td></td> | 404 <td><a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev /zqB-DySA4V0">Discussion thread</a></td> |
372 </tr> | 405 </tr> |
373 | 406 |
374 <tr> | 407 <tr> |
375 <td>Range-Based For Loops</td> | |
376 <td><code>for (<i>type</i> <i>var</i> : <i>range</i>)</code></td> | |
377 <td>Facilitates a more concise syntax for iterating over the elements | |
378 of a container (or a range of iterators) in a <code>for</code> loop</td> | |
379 <td>TODO: documentation link</td> | |
380 <td><a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev /hpzz4EqbVmc">Discussion thread</a></td> | |
381 </tr> | |
382 | |
383 <tr> | |
384 <td>Raw String Literals</td> | 408 <td>Raw String Literals</td> |
385 <td><code>string <i>var</i>=R"(<i>raw_string</i>)";</code></td> | 409 <td><code>string <i>var</i>=R"(<i>raw_string</i>)";</code></td> |
386 <td>Allows a string to be encoded without any escape | 410 <td>Allows a string to be encoded without any escape |
387 sequences, easing parsing in regex expressions, for example</td> | 411 sequences, easing parsing in regex expressions, for example</td> |
388 <td>TODO: documentation link</td> | 412 <td>TODO: documentation link</td> |
389 <td></td> | 413 <td><a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev /2kWQHbbuMHI">Discussion thread</a></td> |
390 </tr> | 414 </tr> |
391 | 415 |
392 <tr> | 416 <tr> |
393 <td>Rvalue References (and Move Semantics)</td> | 417 <td>Rvalue References (and Move Semantics)</td> |
394 <td><code>T(T&& t)</code> and <code>T& operator=(T&& t)</cod e></td> | 418 <td><code>T(T&& t)</code> and <code>T& operator=(T&& t)</cod e></td> |
395 <td>Reference that only binds to a temporary object</td> | 419 <td>Reference that only binds to a temporary object</td> |
396 <td>TODO: documentation link</td> | 420 <td>TODO: documentation link</td> |
397 <td></td> | 421 <td></td> |
398 </tr> | 422 </tr> |
399 | 423 |
400 <tr> | 424 <tr> |
401 <td>Static Assertions</td> | |
402 <td><code>static_assert(<i>bool</i>, <i>string</i>)</code></td> | |
403 <td>Tests compile-time conditions</td> | |
404 <td><a href="http://en.cppreference.com/w/cpp/language/static_assert">Static Ass ertion</a></td> | |
405 <td><a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev /POISBQEhGzU">Discussion thread</a></td> | |
406 </tr> | |
407 | |
408 <tr> | |
409 <td>Union Class Members</td> | 425 <td>Union Class Members</td> |
410 <td><code>union <i>name</i> { <i>class</i> <i>var</i>}</code></td> | 426 <td><code>union <i>name</i> { <i>class</i> <i>var</i>}</code></td> |
411 <td>Allows class type members</td> | 427 <td>Allows class type members</td> |
412 <td><a href="http://en.cppreference.com/w/cpp/language/union"> | 428 <td><a href="http://en.cppreference.com/w/cpp/language/union"> |
413 Union declarations</a></td> | 429 Union declarations</a></td> |
414 <td></td> | 430 <td></td> |
415 </tr> | 431 </tr> |
416 | 432 |
417 <tr> | 433 <tr> |
418 <td>User-Defined Literals</td> | 434 <td>User-Defined Literals</td> |
419 <td><code><i>type</i> <i>var</i> = <i>literal_value</i>_<i>type</i></code></td> | 435 <td><code><i>type</i> <i>var</i> = <i>literal_value</i>_<i>type</i></code></td> |
420 <td>Allows user-defined literal expressions</td> | 436 <td>Allows user-defined literal expressions</td> |
421 <td>TODO: documentation link</td> | 437 <td>TODO: documentation link</td> |
422 <td></td> | 438 <td></td> |
423 </tr> | 439 </tr> |
424 | 440 |
425 <tr> | |
426 <td>Variadic Macros</td> | |
427 <td><code>#define <i>MACRO</i>(...) <i>Impl</i>(<i>args</i>, __VA_ARGS__)</code> </td> | |
428 <td>Allows macros that accept a variable number of arguments</td> | |
429 <td><a href="http://stackoverflow.com/questions/4786649/are-variadic-macros-nons tandard"> | |
430 Are Variadic macros nonstandard?</a></td> | |
431 <td><a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev /sRx9j3CQqyA">Discussion thread</a></td> | |
432 </tr> | |
433 | |
434 <tr> | |
435 <td>Variadic Templates</td> | |
436 <td><code>template <<i>typename</i> ... <i>arg</i>></code></td> | |
437 <td>Allows templates that accept a variable number of arguments</td> | |
438 <td>TODO: documentation link</td> | |
439 <td><a href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev /6ItymeMXpMc">Discussion thread</a></td> | |
440 </tr> | |
441 | |
442 </tbody> | 441 </tbody> |
443 </table> | 442 </table> |
444 | 443 |
445 <h3 id="blacklist_stdlib">C++11 Standard Library features</h3> | 444 <h3 id="blacklist_stdlib">C++11 Standard Library features</h3> |
446 | 445 |
447 <details> | 446 <details> |
448 | 447 |
449 <p><summary class="note">All C++11 <strong>Standard Library features are current ly | 448 <p><summary class="note">All C++11 <strong>Standard Library features are current ly |
450 banned</strong>, because they are not supported on all of our toolchains yet. | 449 banned</strong>, because they are not supported on all of our toolchains yet. |
451 In particular, chromium/android is currently using STLport, and chromium/mac is | 450 In particular, chromium/android is currently using STLport, and chromium/mac is |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
942 </tr> | 941 </tr> |
943 | 942 |
944 </tbody> | 943 </tbody> |
945 </table> | 944 </table> |
946 | 945 |
947 </details> | 946 </details> |
948 | 947 |
949 </div> | 948 </div> |
950 </body> | 949 </body> |
951 </html> | 950 </html> |
OLD | NEW |