Namespace

Quick question:
Does declaring an entire namespace affect a program's performance vs not declaring the entire namespace and doing something like std::cout.

Does it affect the length of the compilation process or after the compilation during runtime
closed account (E0p9LyTq)
No and no.
Hello andrewllewop,

I am not the best person to talk about namespaces, but these links might help you:

http://www.cplusplus.com/search.do?q=namspace

http://www.cplusplus.com/doc/oldtutorial/namespaces/

I do not see where qualifying something with a namespace would make that much difference with compile time unless you have many files with 1000s to 10s of thousands of lines of code. Just my thought.

I do not see where using different namespaces would affect run time because by then namespaces have been dealt with to give you the code to run the program.

Hope that helps some,

Andy

P.S. If I am wrong someone will let us know.
Last edited on
Does declaring an entire namespace affect a program's performance

Depends on what you mean by 'performance' - if it implies greater possibilities for name conflicts and ambiguous reference errors then it certainly does affect performance:
http://stackoverflow.com/questions/2518796/resolving-namespace-conflicts
http://stackoverflow.com/questions/1452721/why-is-using-namespace-std-considered-bad-practice
http://stackoverflow.com/questions/4043930/is-using-namespace-like-bad (the accepted answer from this link is very well written)
Topic archived. No new replies allowed.