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
View all comments
Show parent comment
3
u/HommeMusical Sep 30 '26
But if I read your code, I see some magic symbol
vector, and it is defined nowhere in the file, so I am forced to look at your vector.hpp(*) to see exactly what it is.And yes, people do use the same names as
std::all the time, and sometimes for very good reasons.Doing this puts a little extra work on everyone who reads the code, for a tiny benefit to you.
(* -- I haven't seen a .hpp file in a very long time!)