Is "using namespace std" a bad practice? | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
+ 12

Is "using namespace std" a bad practice?

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

25th Jan 2017, 8:54 AM
Leon lit
Leon lit - avatar
19 Respuestas
+ 30
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.
25th Jan 2017, 9:10 AM
Hatsy Rei
Hatsy Rei - avatar
+ 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. :)
26th Jan 2017, 6:29 PM
Ryan Rockwell
Ryan Rockwell - avatar
+ 8
a very good practice
26th Jan 2017, 2:19 PM
Joseph Lusitche
Joseph Lusitche - avatar
+ 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.
27th Jan 2017, 12:22 AM
rAsHtElL
rAsHtElL - avatar
+ 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.
26th Jan 2017, 4:48 PM
Christopher J Morgan
Christopher J Morgan - avatar
+ 4
no not at all
28th Jan 2017, 6:45 AM
LOKESH MAHAJAN
LOKESH MAHAJAN - avatar
+ 2
no
28th Jan 2017, 10:03 AM
roberta basile
roberta basile - avatar
+ 2
not really. it's only bad practice if you have multiple libs with cobflicting names / functions.
28th Jan 2017, 11:25 AM
Edwin Martens
Edwin Martens - avatar
+ 2
no not at all
28th Jan 2017, 12:51 PM
Harsh jaiswal
Harsh jaiswal - avatar
+ 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
29th Jan 2017, 12:11 AM
Kumar Shivam Ray
Kumar Shivam Ray - avatar
+ 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
29th Jan 2017, 2:48 PM
Nikhil nikk
Nikhil nikk - avatar
+ 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.
29th Jan 2017, 4:16 PM
Nishant P. Borah
Nishant P. Borah - avatar
+ 2
no
29th Jan 2017, 5:15 PM
Fady M. Huwaidy
Fady M. Huwaidy - avatar
+ 1
we use conio in the place of using namespace std?
29th Jan 2017, 1:51 PM
Pradeep Pal
Pradeep Pal - avatar
+ 1
no
29th Jan 2017, 2:43 PM
Konduru. Chandana Sree
Konduru. Chandana Sree - avatar
+ 1
No.. We have good practice now
29th Jan 2017, 8:03 PM
Bilal Butt
Bilal Butt - avatar
+ 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
29th Jan 2017, 9:30 PM
Oussama Jaaouani
Oussama Jaaouani - avatar
30th Jan 2017, 10:17 AM
Nat√°n Tabraj
Nat√°n Tabraj - avatar
- 1
no, it isn't.
29th Jan 2017, 11:15 PM
Andreea Antonache
Andreea Antonache - avatar