@@ -4894,6 +4894,46 @@ <h3 id="Constant_Names">Constant Names</h3>
48944894convention is optional for variables of other storage classes, e.g., automatic
48954895variables, otherwise the usual variable naming rules apply.</ p >
48964896
4897+ < div class ="drake ">
4898+
4899+ < p > Never use < code > kMixedCase</ code > style for template arguments. In the
4900+ typical case, a template argument will refer to differing values within the
4901+ same program, so is not a program-wide constant.</ p >
4902+
4903+ < pre > // OK - num_stages names to a value that is not a program-wide constant.
4904+
4905+ template <typename T, int num_stages = 2>
4906+ class RadauIntegrator { ... };
4907+ </ pre >
4908+
4909+ < pre class ="badcode "> // BAD - kNumStages is not a program-wide constant.
4910+
4911+ template <typename T, int kNumStages = 2>
4912+ class RadauIntegrator { ... };
4913+ </ pre >
4914+
4915+ < p > Even in the case of class data members (whether static or non-static),
4916+ never add a trailing underscore to a < code > kMixedCase</ code > name.</ p >
4917+
4918+ < pre > class Foo {
4919+ ...
4920+ private:
4921+ const std::string default_name_{"name"}; // OK - snake_case_ member.
4922+ const std::string kDefaultName{"name"}; // OK - program-wide constant.
4923+ static const int kDefaultValue{1000}; // OK - static constant.
4924+ };
4925+ </ pre >
4926+
4927+ < pre class ="badcode "> class Foo {
4928+ ...
4929+ private:
4930+ const std::string kDefaultName_{"name"}; // Bad - underscore.
4931+ static const int kDefaultValue_{1000}; // Bad - underscore.
4932+ };
4933+ </ pre >
4934+
4935+ </ div >
4936+
48974937< h3 id ="Function_Names "> Function Names</ h3 >
48984938
48994939< p > Regular functions have mixed case; accessors and mutators may be named
0 commit comments