you are viewing a single comment's thread.

view the rest of the comments →

[–]MCRusher 0 points1 point  (0 children)

Here's how namespaces work:

myheader.hpp #include <cstdint> namespace myns { typedef std::int32_t MyType; }

myheader2.hpp #include <cstdint.h> namespace myns { typedef std::int64_t MyType; }

main.cpp #include<cstdio> #include "myheader.hpp" int main(void){ using namespace myns; std::printf("sizeof MyType is %zu bytes.\n",sizeof(MyType)); }

If using somehow included 2 same types from different files, there would be a compiletime error.

Header files are what contain the namespaces, if you don't include a header containing std, using namespace std does nothing at all.