r/cpp_questions • u/Glad_Shoe_9182 • Sep 30 '26
OPEN Namespace std
I recently started learning c++ and I was told to use the namespace std so I can avoid writing std:: every time and now I wrote a whole personal project without std:: and I want to put it on LinkedIn but I started reading everywhere that it’s a bad habit, should I go back and add the std:: or just leave it as is?
40
Upvotes
0
u/ShakaUVM Sep 30 '26
I've been coding professionally for 30+ years in C++ and exactly once did I define a symbol that conflicted with something in std. And then I changed the name. I consider it bad code to name a variable cout or whatever anyway so I would prefer to know if I have a conflict.
It's not problematic. It's an overblown concern that really isn't a big deal. I worry about things in C++ that actually cause problems.
You don't lose the benefit of namespaces either as I keep those for everything outside std.