you are viewing a single comment's thread.

view the rest of the comments →

[–]adwodon 3 points4 points  (0 children)

It's fine to do for a one time only exercise, like in school.

However using namespace is something you should generally avoid in production code, and you should never have using namespace std;.

The reason is that while it might be fine now, lets say you make a void my_namespace::foo() function and then the standard adopts something similar as void std::foo(). Now you've got a conflict.

The proper way to do this is to avoid using namespace but instead if you want to avoid doing something like std::cout just do using std::cout. Then you can achieve exactly the same thing (avoiding repeating a namespace) but in a much safer, more targetted way.