diff --git a/cppguide.html b/cppguide.html index 7c87799ed..7fcb1fc55 100644 --- a/cppguide.html +++ b/cppguide.html @@ -399,8 +399,8 @@
Include headers in the following order: Related header, C system headers, C++ standard library headers, other libraries' headers, your project's -headers.
- +headers. +The includes should be ordered alphabetically. This ordering should be case-sensitive, meaningthat uppercase and lowercase letters are considered to be differentAll of a project's header files should be listed as descendants of the project's source @@ -498,7 +498,6 @@
With few exceptions, place code in a namespace. Namespaces
should have unique names based on the project name, and possibly
-its path. Do not use using-directives (e.g.,
-using namespace foo
). Do not use
+its path. Do not use using-namespacedirectives (e.g.,
+using namespace foo;
). Do not use
inline namespaces. For unnamed namespaces, see
Internal Linkage.
+
Using declaration are allowed and can be used to refer to specific symbol from a namespace. For example
+Using ::foo::bar;
+
+Using namespace directives brings the all the specified symbols/built-in-types from the specified NameSpace into the whatever current scope you are in, which leads to naming conflict and confusion(ambiguity). Therefore, they should be avoided.
+ +Example:
+//Avoid This Practice:
+using namespace std;
+std::cout,std::endl or somethinglike std::string st = "Hello";
+
+Using Declarations allow you to bring namespace into current scope. This practice helps in avoiding the ambiguity(confusion) and which eventually keeps the code clear and manageable.
+Example to Use:
+//Accepted
+ using namespace std;
+ cout,abs() or string str = "Hello,World";
+
Namespaces subdivide the global scope into distinct, named scopes, and so are useful for preventing name collisions in the global scope.
@@ -6020,4 +6041,4 @@