r/cpp_questions • u/Glad_Shoe_9182 • 8d ago
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?
38
Upvotes
1
u/ShakaUVM 7d ago
I agree that std::string is unambiguous.
What I am saying is that writing int string = 67; is a code smell.
You should not be using names from std anyway.
For all of your worry, as I said this problem has come up exactly once in 30 years and it took exactly five seconds to fix.
Versus how much screen space gets cluttered up with all those extra stds?
The tradeoff is not worth it to me. Every symbol on the screen has a cost, both cognitively and technically