Chromium Code Reviews| 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 17 matching lines...) Expand all Loading... | |
| 28 allowed in Chromium and contains pointers to more detailed information. The | 28 allowed in Chromium and contains pointers to more detailed information. The |
| 29 Guide applies to Chromium and its subprojects. Subprojects can choose to be | 29 Guide applies to Chromium and its subprojects. Subprojects can choose to be |
| 30 more restrictive if they need to compile on more toolchains than Chromium.</p> | 30 more restrictive if they need to compile on more toolchains than Chromium.</p> |
| 31 | 31 |
| 32 <p>You can propose to make a feature available or to ban a | 32 <p>You can propose to make a feature available or to ban a |
| 33 feature by sending an email to <a | 33 feature by sending an email to <a |
| 34 href="https://groups.google.com/a/chromium.org/forum/#!forum/cxx">cxx@chromium.o rg</a>. | 34 href="https://groups.google.com/a/chromium.org/forum/#!forum/cxx">cxx@chromium.o rg</a>. |
| 35 Ideally include a short blurb on what the feature is, and why you think it | 35 Ideally include a short blurb on what the feature is, and why you think it |
| 36 should or should not be allowed. Ideally, the list will arrive at some | 36 should or should not be allowed. Ideally, the list will arrive at some |
| 37 consensus and the wiki page will be updated to mention that consensus. If | 37 consensus and the wiki page will be updated to mention that consensus. If |
| 38 there's no consensus, <code>src/styleguide/C++/OWNERS</code> get to decide -- | 38 there's no consensus, <code>src/styleguide/c++/OWNERS</code> get to decide -- |
| 39 for divisive features, we expect the decision to be to not use the feature yet | 39 for divisive features, we expect the decision to be to not use the feature yet |
| 40 and possibly discuss it again a few months later, when we have more experience | 40 and possibly discuss it again a few months later, when we have more experience |
| 41 with the language.</p> | 41 with the language.</p> |
| 42 | 42 |
| 43 <h2 id="whitelist">C++11 Allowed Features</h2> | 43 <h2>Table of Contents</h2> |
| 44 <ol class="toc"> | |
| 45 <li>Allowed Features<ol> | |
| 46 <li><a href="#core-whitelist">Language</a></li> | |
| 47 <li><a href="#library-whitelist"/>Library</a></li> | |
| 48 </ol></li> | |
| 49 <li>Banned Features<ol> | |
| 50 <li><a href="#core-blacklist"/>Language</a></li> | |
| 51 <li><a href="#library-blacklist"/>Library</a></li> | |
| 52 </ol></li> | |
| 53 <li>To Be Discussed<ol> | |
| 54 <li><a href="#core-review"/>Language</a></li> | |
| 55 <li><a href="#library-review"/>Library</a></li> | |
| 56 </ol></li> | |
| 57 </ol> | |
| 58 | |
| 59 <h2 id="whitelist"><a name="core-whitelist"/>C++11 Allowed Features</h2> | |
|
Nico
2015/11/17 23:06:23
Isn't it <a></a> due to doctype html? (http://stac
danakj
2015/11/17 23:08:58
TIL.
| |
| 44 | 60 |
| 45 <p>The following features are currently allowed.</p> | 61 <p>The following features are currently allowed.</p> |
| 46 | 62 |
| 47 <table id="whitelist_lang_list" class="unlined striped"> | 63 <table id="whitelist_lang_list" class="unlined striped"> |
| 48 <tbody> | 64 <tbody> |
| 49 | 65 |
| 50 <tr> | 66 <tr> |
| 51 <th style='width:220px;'>Feature</th> | 67 <th style='width:220px;'>Feature</th> |
| 52 <th style='width:260px;'>Snippet</th> | 68 <th style='width:260px;'>Snippet</th> |
| 53 <th style='width:240px;'>Description</th> | 69 <th style='width:240px;'>Description</th> |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 251 <td><code>template <<i>typename</i> ... <i>arg</i>></code></td> | 267 <td><code>template <<i>typename</i> ... <i>arg</i>></code></td> |
| 252 <td>Allows templates that accept a variable number of arguments</td> | 268 <td>Allows templates that accept a variable number of arguments</td> |
| 253 <td><a href="http://en.cppreference.com/w/cpp/language/parameter_pack"> | 269 <td><a href="http://en.cppreference.com/w/cpp/language/parameter_pack"> |
| 254 Parameter pack</a></td> | 270 Parameter pack</a></td> |
| 255 <td>Usage should be rare. Use instead of .pump files. <a href="https://groups.go ogle.com/a/chromium.org/forum/#!topic/chromium-dev/6ItymeMXpMc">Discussion threa d</a></td> | 271 <td>Usage should be rare. Use instead of .pump files. <a href="https://groups.go ogle.com/a/chromium.org/forum/#!topic/chromium-dev/6ItymeMXpMc">Discussion threa d</a></td> |
| 256 </tr> | 272 </tr> |
| 257 | 273 |
| 258 </tbody> | 274 </tbody> |
| 259 </table> | 275 </table> |
| 260 | 276 |
| 261 <h2 id="whitelist">C++11 Allowed Library Features</h2> | 277 <h2 id="whitelist"><a name="library-whitelist"/>C++11 Allowed Library Features</ h2> |
| 262 | 278 |
| 263 <p>The following library features are currently allowed.</p> | 279 <p>The following library features are currently allowed.</p> |
| 264 | 280 |
| 265 <table id="whitelist_lib_list" class="unlined striped"> | 281 <table id="whitelist_lib_list" class="unlined striped"> |
| 266 <tbody> | 282 <tbody> |
| 267 | 283 |
| 268 <tr> | 284 <tr> |
| 269 <th style='width:240px;'>Feature or Library</th> | 285 <th style='width:240px;'>Feature or Library</th> |
| 270 <th style='width:240px;'>Snippet</th> | 286 <th style='width:240px;'>Snippet</th> |
| 271 <th style='width:240px;'>Description</th> | 287 <th style='width:240px;'>Description</th> |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 298 <td>Note: std::move() is allowed but writing your own move constructors is still only allowed in exceptional cases for now, see 'Rvalue References (and Move Sem antics)'. <a href='https://groups.google.com/a/chromium.org/forum/#!topic/cxx/x_ dWFxJFdbM'>Discussion thread</a></td> | 314 <td>Note: std::move() is allowed but writing your own move constructors is still only allowed in exceptional cases for now, see 'Rvalue References (and Move Sem antics)'. <a href='https://groups.google.com/a/chromium.org/forum/#!topic/cxx/x_ dWFxJFdbM'>Discussion thread</a></td> |
| 299 </tr> | 315 </tr> |
| 300 | 316 |
| 301 </tbody> | 317 </tbody> |
| 302 </table> | 318 </table> |
| 303 | 319 |
| 304 <h2 id="blacklist">C++11 Blacklist (Disallowed and Banned Features)</h2> | 320 <h2 id="blacklist">C++11 Blacklist (Disallowed and Banned Features)</h2> |
| 305 | 321 |
| 306 <p>This section lists features that are not allowed to be used yet. | 322 <p>This section lists features that are not allowed to be used yet. |
| 307 | 323 |
| 308 <h3 id="blacklist_banned">C++11 Banned Features</h3> | 324 <h3 id="blacklist_banned"><a name="core-blacklist"/>C++11 Banned Features</h3> |
| 309 | 325 |
| 310 <p>This section lists C++11 features that are not allowed in the Chromium | 326 <p>This section lists C++11 features that are not allowed in the Chromium |
| 311 codebase. | 327 codebase. |
| 312 </p> | 328 </p> |
| 313 | 329 |
| 314 <table id="banned_list" class="unlined striped"> | 330 <table id="banned_list" class="unlined striped"> |
| 315 <tbody> | 331 <tbody> |
| 316 | 332 |
| 317 <tr> | 333 <tr> |
| 318 <th style='width:240px;'>Feature or Library</th> | 334 <th style='width:240px;'>Feature or Library</th> |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 421 <td><code>u8"<i>string</i>", u"<i>string</i>", U"<i>str ing</i>"</code></td> | 437 <td><code>u8"<i>string</i>", u"<i>string</i>", U"<i>str ing</i>"</code></td> |
| 422 <td>Enforces UTF-8, UTF-16, UTF-32 encoding on all string literals</td> | 438 <td>Enforces UTF-8, UTF-16, UTF-32 encoding on all string literals</td> |
| 423 <td><a href="http://en.cppreference.com/w/cpp/language/string_literal"> | 439 <td><a href="http://en.cppreference.com/w/cpp/language/string_literal"> |
| 424 string literal</a></td> | 440 string literal</a></td> |
| 425 <td>Does not yet work in MSVS2013. Reevaluate once it does. <a href="https://gro ups.google.com/a/chromium.org/forum/#!topic/chromium-dev/gcoUbcjfsII">Discussion thread</a></td> | 441 <td>Does not yet work in MSVS2013. Reevaluate once it does. <a href="https://gro ups.google.com/a/chromium.org/forum/#!topic/chromium-dev/gcoUbcjfsII">Discussion thread</a></td> |
| 426 </tr> | 442 </tr> |
| 427 | 443 |
| 428 </tbody> | 444 </tbody> |
| 429 </table> | 445 </table> |
| 430 | 446 |
| 431 <h3 id="whitelist">C++11 Banned Library Features</h3> | 447 <h3 id="blacklist_stdlib"><a name="library-blacklist"/>C++11 Banned Library Feat ures</h3> |
| 432 | 448 |
| 433 <p>This section lists C++11 library features that are not allowed in the Chromiu m codebase.</p> | 449 <p>This section lists C++11 library features that are not allowed in the Chromiu m codebase.</p> |
| 434 | 450 |
| 435 <table id="blacklist_lib_list" class="unlined striped"> | 451 <table id="blacklist_lib_list" class="unlined striped"> |
| 436 <tbody> | 452 <tbody> |
| 437 | 453 |
| 438 <tr> | 454 <tr> |
| 439 <th style='width:240px;'>Feature</th> | 455 <th style='width:240px;'>Feature</th> |
| 440 <th style='width:240px;'>Snippet</th> | 456 <th style='width:240px;'>Snippet</th> |
| 441 <th style='width:240px;'>Description</th> | 457 <th style='width:240px;'>Description</th> |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 465 <mutex>, <condition_variable></code></td> | 481 <mutex>, <condition_variable></code></td> |
| 466 <td>Provides a standard mulitthreading library using <code>std::thread</code> an d associates</td> | 482 <td>Provides a standard mulitthreading library using <code>std::thread</code> an d associates</td> |
| 467 <td><a href="http://en.cppreference.com/w/cpp/thread">Thread support library</a> </td> | 483 <td><a href="http://en.cppreference.com/w/cpp/thread">Thread support library</a> </td> |
| 468 <td>C++11 has all kinds of classes for threads, mutexes, etc. Since we already h ave good code for this in <code>base/</code>, we should keep using the base clas ses, at least at first. <code>base::Thread</code> is tightly coupled to <code>Me ssageLoop</code> which would make it hard to replace. We should investigate usin g standard mutexes, or unique_lock, etc. to replace our locking/synchronization classes.</td> | 484 <td>C++11 has all kinds of classes for threads, mutexes, etc. Since we already h ave good code for this in <code>base/</code>, we should keep using the base clas ses, at least at first. <code>base::Thread</code> is tightly coupled to <code>Me ssageLoop</code> which would make it hard to replace. We should investigate usin g standard mutexes, or unique_lock, etc. to replace our locking/synchronization classes.</td> |
| 469 </tr> | 485 </tr> |
| 470 | 486 |
| 471 </tbody> | 487 </tbody> |
| 472 </table> | 488 </table> |
| 473 | 489 |
| 474 | 490 |
| 475 <h3 id="blacklist_review">C++11 Features To Be Discussed</h3> | 491 <h3 id="blacklist_review"><a name="core-review"/>C++11 Features To Be Discussed< /h3> |
| 476 | 492 |
| 477 <p>The following C++ language features are currently disallowed. | 493 <p>The following C++ language features are currently disallowed. |
| 478 See the top of this page on how to propose moving a feature from this list | 494 See the top of this page on how to propose moving a feature from this list |
| 479 into the allowed or banned sections. Note that not all of these features | 495 into the allowed or banned sections. Note that not all of these features |
| 480 work in all our compilers yet.</p> | 496 work in all our compilers yet.</p> |
| 481 | 497 |
| 482 <table id="blacklist_review_list" class="unlined striped"> | 498 <table id="blacklist_review_list" class="unlined striped"> |
| 483 <tbody> | 499 <tbody> |
| 484 | 500 |
| 485 <tr> | 501 <tr> |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 563 <td><code><i>type</i> <i>var</i> = <i>literal_value</i>_<i>type</i></code></td> | 579 <td><code><i>type</i> <i>var</i> = <i>literal_value</i>_<i>type</i></code></td> |
| 564 <td>Allows user-defined literal expressions</td> | 580 <td>Allows user-defined literal expressions</td> |
| 565 <td><a href="http://en.cppreference.com/w/cpp/language/user_literal"> | 581 <td><a href="http://en.cppreference.com/w/cpp/language/user_literal"> |
| 566 User-defined literals</a></td> | 582 User-defined literals</a></td> |
| 567 <td></td> | 583 <td></td> |
| 568 </tr> | 584 </tr> |
| 569 | 585 |
| 570 </tbody> | 586 </tbody> |
| 571 </table> | 587 </table> |
| 572 | 588 |
| 573 <h3 id="blacklist_stdlib">C++11 Standard Library Features To Be Discussed</h3> | 589 <h3 id="blacklist_stdlib_review"><a name="library-review"/>C++11 Standard Librar y Features To Be Discussed</h3> |
| 574 | 590 |
| 575 <p>The following C++ library features are currently disallowed. See the top of t his page on how to propose moving a feature from this list into the allowed or b anned sections. Note that not all of these features work in all our compilers ye t.</p> | 591 <p>The following C++ library features are currently disallowed. See the top of t his page on how to propose moving a feature from this list into the allowed or b anned sections. Note that not all of these features work in all our compilers ye t.</p> |
| 576 | 592 |
| 577 <table id="banned_stdlib" class="unlined striped"> | 593 <table id="banned_stdlib" class="unlined striped"> |
| 578 | 594 |
| 579 <tbody> | 595 <tbody> |
| 580 <tr> | 596 <tr> |
| 581 <th style='width:240px;'>Feature</th> | 597 <th style='width:240px;'>Feature</th> |
| 582 <th style='width:240px;'>Snippet</th> | 598 <th style='width:240px;'>Snippet</th> |
| 583 <th style='width:240px;'>Description</th> | 599 <th style='width:240px;'>Description</th> |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1035 C++ Style Guide</a>. However, may be useful for | 1051 C++ Style Guide</a>. However, may be useful for |
| 1036 consuming non-ASCII data.</td> | 1052 consuming non-ASCII data.</td> |
| 1037 </tr> | 1053 </tr> |
| 1038 | 1054 |
| 1039 </tbody> | 1055 </tbody> |
| 1040 </table> | 1056 </table> |
| 1041 | 1057 |
| 1042 </div> | 1058 </div> |
| 1043 </body> | 1059 </body> |
| 1044 </html> | 1060 </html> |
| OLD | NEW |