@@ -84,8 +84,26 @@ Keep in mind hover documentation often isn't readily available for pull request
84
84
reviewers. Most of the time, reviewers will use GitHub's online viewer to review
85
85
pull requests.
86
86
87
- We chose to forbid ``auto `` instead of allowing it on a case-by-case basis to
88
- avoid having to decide on difficult edge cases. Thank you for your understanding.
87
+ The ``auto `` keyword can be used in some special cases, like C++ lambda or Objective-C block
88
+ definitions and C++ templates. Please ask before using templates with ``auto `` in a pull request.
89
+
90
+ .. code-block :: cpp
91
+
92
+ // Full type definitions.
93
+ void (*mult64to128)(uint64_t, uint64_t, uint64_t &, uint64_t &) = [](uint64_t u, uint64_t v, uint64_t &h, uint64_t &l) { ... }
94
+ void (^JOYSTICK_LEFT)(GCControllerDirectionPad *__strong, float, float) = ^(GCControllerDirectionPad *dpad, float xValue, float yValue) { ... }
95
+
96
+ // Less clutter with auto.
97
+ auto mult64to128 = [](uint64_t u, uint64_t v, uint64_t &h, uint64_t &l) { ... }
98
+ auto JOYSTICK_LEFT = ^(GCControllerDirectionPad *dpad, float xValue, float yValue) { ... }
99
+
100
+ // Compare function for different types.
101
+ template <typename T1, typename T2>
102
+ constexpr auto MIN(const T1 m_a, const T2 m_b) {
103
+ return m_a < m_b ? m_a : m_b;
104
+ }
105
+
106
+ We chose to forbid ``auto `` in all other cases. Thank you for your understanding.
89
107
90
108
Lambdas
91
109
~~~~~~~
@@ -94,12 +112,6 @@ Lambdas should be used conservatively when they make code effectively faster or
94
112
simpler, and do not impede readability. Please ask before using lambdas in a
95
113
pull request.
96
114
97
- ``#pragma once `` directive
98
- ~~~~~~~~~~~~~~~~~~~~~~~~~~
99
-
100
- To follow the existing style, please use standard ``#ifdef ``-based include
101
- guards instead of ``#pragma once `` in new files.
102
-
103
115
``try ``-``catch `` blocks
104
116
~~~~~~~~~~~~~~~~~~~~~~~~
105
117
0 commit comments