Repository: mesos Updated Branches: refs/heads/master 0d717e08e -> 6e57f67af
Clarified naming rules in C++ style guide. This patch clarifies the differences in naming rules between Mesos application code and the libprocess/stout libraries. It also updates Wikipedia links to point to more instructive portions of the relevant entries. Review: https://reviews.apache.org/r/57177/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/6e57f67a Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/6e57f67a Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/6e57f67a Branch: refs/heads/master Commit: 6e57f67afe566a23b32381270bd4217b19a55e0f Parents: 0d717e0 Author: Greg Mann <[email protected]> Authored: Wed Mar 1 10:40:27 2017 -0800 Committer: Vinod Kone <[email protected]> Committed: Wed Mar 1 10:40:27 2017 -0800 ---------------------------------------------------------------------- docs/c++-style-guide.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/6e57f67a/docs/c++-style-guide.md ---------------------------------------------------------------------- diff --git a/docs/c++-style-guide.md b/docs/c++-style-guide.md index 176562d..18f716b 100644 --- a/docs/c++-style-guide.md +++ b/docs/c++-style-guide.md @@ -16,7 +16,8 @@ The Mesos codebase follows the [Google C++ Style Guide](https://google.github.io ## Naming ### Variable Names -* We use [lowerCamelCase](http://en.wikipedia.org/wiki/CamelCase#Variations_and_synonyms) for variable names (Google uses snake_case, and their class member variables have trailing underscores). +* We use [lowerCamelCase](https://en.wikipedia.org/wiki/Camel_case) for variable names in Mesos application code (Google uses snake_case, and their class member variables have trailing underscores). +* We use [snake_case](https://en.wikipedia.org/wiki/Snake_case) for variable names in the libprocess and stout libraries. * We prepend constructor and function arguments with a leading underscore to avoid ambiguity and / or shadowing: ~~~{.cpp} @@ -40,10 +41,14 @@ void Slave::statusUpdate(StatusUpdate update, const UPID& pid) ~~~ ### Constant Names -* We use [SCREAMING_SNAKE_CASE](http://en.wikipedia.org/wiki/Letter_case#Special_case_styles) for constant names (Google uses a `k` followed by mixed case, e.g. `kDaysInAWeek`). +* We use [SCREAMING_SNAKE_CASE](http://en.wikipedia.org/wiki/Letter_case#Special_case_styles) for constant names in Mesos, libprocess, and stout (Google uses a `k` followed by mixed case, e.g. `kDaysInAWeek`). ### Function Names -* We use [lowerCamelCase](http://en.wikipedia.org/wiki/CamelCase#Variations_and_synonyms) for function names (Google uses mixed case for regular functions; and their accessors and mutators match the name of the variable). +* We use [lowerCamelCase](https://en.wikipedia.org/wiki/Camel_case) for function names in Mesos application code (Google uses mixed case for regular functions; and their accessors and mutators match the name of the variable). +* We use [snake_case](https://en.wikipedia.org/wiki/Snake_case) for function names in the libprocess and stout libraries. + +### Class Names +* We use [UpperCamelCase](https://en.wikipedia.org/wiki/Camel_case) for class and struct names in Mesos, libprocess, and stout. ## Strings * Strings used in log and error messages should end without a period.
