You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2015/09/30 01:48:43 UTC

mesos git commit: Updated the C++ style guide with namespace aliases.

Repository: mesos
Updated Branches:
  refs/heads/master 2844a9617 -> c250c0625


Updated the C++ style guide with namespace aliases.

Review: https://reviews.apache.org/r/38452


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/c250c062
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/c250c062
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/c250c062

Branch: refs/heads/master
Commit: c250c062590b63675474021e0afe2069d3e99317
Parents: 2844a96
Author: Guangya Liu <gy...@gmail.com>
Authored: Tue Sep 29 16:47:27 2015 -0700
Committer: Benjamin Mahler <be...@gmail.com>
Committed: Tue Sep 29 16:48:19 2015 -0700

----------------------------------------------------------------------
 docs/mesos-c++-style-guide.md | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/c250c062/docs/mesos-c++-style-guide.md
----------------------------------------------------------------------
diff --git a/docs/mesos-c++-style-guide.md b/docs/mesos-c++-style-guide.md
index 570ea68..02f4dc9 100644
--- a/docs/mesos-c++-style-guide.md
+++ b/docs/mesos-c++-style-guide.md
@@ -6,6 +6,12 @@ layout: documentation
 
 The Mesos codebase follows the [Google C++ Style Guide](http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml) with the following differences:
 
+## Scoping
+
+### Namespaces
+* We avoid `using namespace foo` statements as it is not explicit about which symbols are pulled in, and it can often pull in a lot of symbols, which sometimes lead to conflicts.
+* We suggest using namespace aliases to help pull in sub namespaces, such as `namespace bar = foo::bar;`; or using the full sub namespaces, such as `using namespace foo::bar;` where `bar` is the exact symbol you want to use. These should only be present at the top of the .cpp file.
+
 ## Naming
 
 ### Variable Names
@@ -38,9 +44,6 @@ void Slave::statusUpdate(StatusUpdate update, const UPID& pid)
 ### 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).
 
-### Namespace Names
-* We do not use namespace aliases.
-
 ## Strings
 * Strings used in log and error messages should end without a period.