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

Side by Side Diff: styleguide/c++/c++11.html

Issue 699283002: c++11: Allow lambdas, with some restrictions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 6 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 109
110 <tr> 110 <tr>
111 <td>Final Specifier</td> 111 <td>Final Specifier</td>
112 <td><code>final</code></td> 112 <td><code>final</code></td>
113 <td> Indicates that a class or function is final and cannot be overridden</td> 113 <td> Indicates that a class or function is final and cannot be overridden</td>
114 <td><a href="http://en.cppreference.com/w/cpp/language/final">final Language Ref erence</a></td> 114 <td><a href="http://en.cppreference.com/w/cpp/language/final">final Language Ref erence</a></td>
115 <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> 115 <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>
116 </tr> 116 </tr>
117 117
118 <tr> 118 <tr>
119 <td>Lambda Expressions</td>
120 <td><code>[<i>captures</i>](<i>params</i>) -&gt; <i>ret</i> { <i>body</i> }</cod e></td>
121 <td>Anonymous functions</td>
122 <td><a href="http://en.cppreference.com/w/cpp/language/lambda">Lambda functions< /a></td>
123 <td>Only use lambdas in cases where they will run in the current thread of
jamesr 2014/11/04 21:08:49 language feels a little weaker than we intend - a
Peter Kasting 2014/11/04 21:10:36 We explicitly say "Do not bind or store lambdas" r
Nico 2014/11/04 21:12:49 It says "Do not bind or store lambdas" a few lines
124 execution. For example, a lambda may be used as a functor parameter to
125 methods or functions that will use it immediately, such as those in
126 <code>&lt;algorithm&gt;</code>. Do not bind or store lambdas; use
127 <code>base::Bind</code> and <code>base::Callback</code> instead, because they
128 offer protection against a large class of object lifetime mistakes. Don't use
129 default captures (<code>[=]</code>, <code>[&amp;]</code> &ndash; <a
130 href="https://google-styleguide.googlecode.com/svn/trunk/cppguide.html#Lambda_ex pressions">Google Style Guide</a>). <a
131 href="https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/D9 UnnxBnciQ">Discussion thread</a></td> </tr>
132
133 <tr>
119 <td>Local Types as Template Arguments</td> 134 <td>Local Types as Template Arguments</td>
120 <td></td> 135 <td></td>
121 <td>Allows local and unnamed types as template arguments</td> 136 <td>Allows local and unnamed types as template arguments</td>
122 <td><a href="http://stackoverflow.com/questions/742607/using-local-classes-with- stl-algorithms"> 137 <td><a href="http://stackoverflow.com/questions/742607/using-local-classes-with- stl-algorithms">
123 Local types, types without linkage and unnamed types as template arguments</a></ td> 138 Local types, types without linkage and unnamed types as template arguments</a></ td>
124 <td>Usage should be rare. Approved without discussion.</td> 139 <td>Usage should be rare. Approved without discussion.</td>
125 </tr> 140 </tr>
126 141
127 <tr> 142 <tr>
128 <td>Null Pointer Constant</td> 143 <td>Null Pointer Constant</td>
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 423
409 <tr> 424 <tr>
410 <td>Inline Namespaces</td> 425 <td>Inline Namespaces</td>
411 <td><code>inline</code></td> 426 <td><code>inline</code></td>
412 <td>Allows better versioning of namespaces</td> 427 <td>Allows better versioning of namespaces</td>
413 <td><a href="http://en.cppreference.com/w/cpp/language/namespace">Namespaces</a> </td> 428 <td><a href="http://en.cppreference.com/w/cpp/language/namespace">Namespaces</a> </td>
414 <td>Unclear how it will work with components</td> 429 <td>Unclear how it will work with components</td>
415 </tr> 430 </tr>
416 431
417 <tr> 432 <tr>
418 <td>Lambda Expressions</td>
419 <td><code>[<i>captures</i>](<i>params</i>) -&gt; <i>ret</i> { <i>body</i> }</cod e></td>
420 <td>Anonymous functions</td>
421 <td><a href="http://en.cppreference.com/w/cpp/language/lambda">Lambda functions< /a></td>
422 <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>
423 </tr>
424
425 <tr>
426 <td>Non-Static Class Member Initializers</td> 433 <td>Non-Static Class Member Initializers</td>
427 <td> 434 <td>
428 <code> 435 <code>
429 class C {<br /> 436 class C {<br />
430 <i>type</i> <i>var</i> = <i>value</i>;<br/> 437 <i>type</i> <i>var</i> = <i>value</i>;<br/>
431 C() // copy-initializes <i>var</i><br/> 438 C() // copy-initializes <i>var</i><br/>
432 </code> 439 </code>
433 <td>Allows non-static class members to be initialized at their definitions (outs ide constructors)</td> 440 <td>Allows non-static class members to be initialized at their definitions (outs ide constructors)</td>
434 <td><a href="http://en.cppreference.com/w/cpp/language/data_members"> 441 <td><a href="http://en.cppreference.com/w/cpp/language/data_members">
435 Non-static data members</a></td> 442 Non-static data members</a></td>
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
956 </tr> 963 </tr>
957 964
958 </tbody> 965 </tbody>
959 </table> 966 </table>
960 967
961 </details> 968 </details>
962 969
963 </div> 970 </div>
964 </body> 971 </body>
965 </html> 972 </html>
OLDNEW
« 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