openbmc / pldm

Apache License 2.0
31 stars 40 forks source link

using namespace in header files #26

Open bradbishop opened 3 years ago

bradbishop commented 3 years ago

git grep 'using namespace' **.hpp

"using namespace" at global scope a header violates the cpp core guidelines:

https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rs-using-directive

"using namespace" in namespace scope is not called out but it is equally frowned upon because unexpected side effects:

foo.hpp:

namespace foo
{
    using namespace std;
};

main.cpp:

#include foo.hpp
using namespace foo; // oops - I have now pulled in namespace std?!?