Is "using namespace std" a bad practice? | SoloLearn: Learn to code for FREE!

+12

Is "using namespace std" a bad practice?

is exercising "using namespace std " in code considered as a wrong practice.........

1/25/2017 8:54:25 AM

Leon lit

19 Answers

New Answer

+28

No. It isn't a bad/wrong practice, BUT, but only if you know what you are doing. There is no problem using "using namespace std" in your source file when you make heavy use of the namespace and know for sure that nothing will collide. However, you should also be able to write codes without using "using namespace std". If you work in an organisation and the supervisor of your specific project decides to ban the use of it, you'll have to be flexible switching to std::cout, std::string, etc.

+10

No one would want to have an std, cmon now. huehue jk, this questions already been answered, just wanted to pin point who' the village idiot is. me. :)

+8

No, its a standard practice. Namespace is just a way of organising your code and giving you better understanding about the group which the code belongs to. Its a good practice to use the std namespace especially when you are working on an official project. It enhances code readability.

+6

Ok for rookie but bad for pro's, as many older programs still in use are written without no namespace and use std all over the place. so knowing how to write good code without using no namespace is a good skill to develop also helps when understanding old code.

+4

a very good practice

+4

no not at all

+2

+2

not really. it's only bad practice if you have multiple libs with cobflicting names / functions.

+2

no not at all

+2

No. It's not a wrong practice, instead it is a good one. As some compiler don't accept "#include<iostream.h>", writing "using namespace std;" comes handy

+2

using namespace std is important because it relates us to basic and if we know basic, problem solving becomes easier it relates us to use a programming language

+2

No. It's not a bad practice. But, it is necessary for the coder to actually know it's use. I know many people who only know it is used so that the program can compile, not knowing what it actually stands for or does. Make sure you don't become that kind.

+2

+1

we use conio in the place of using namespace std?

+1

+1

No.. We have good practice now

+1

if you review source code of different big projects as game engines they don't the instruction at all they use instead std::class

+1

http://www.cplusplus.com/doc/tutorial/namespaces/ I hope it helps you.

-1

no, it isn't.