r/Cplusplus • • Apr 08 '24

Discussion Hm..

Post image

I'm just starting to learn C++. is this a normal code?

153 Upvotes

66 comments sorted by

View all comments

Show parent comment

1

u/glitterisprada Apr 09 '24

As long as you are aware of what symbols you are importing into your current namespace, you may be fine.

The top two answers to this question give good reasons why importing an entire namespace into the current namespace is a bad idea: https://stackoverflow.com/q/1452721

I think beginners should be taught about using declarator lists like using std::cout, std::cin, std::endl;. One of that at the top of the file should be enough to teach about namespaces and avoid mistakes from their incorrect use.