using namespace or std:: ?
Hello... havent been here in YEARS... lol yeah years..
anyway... I have a quick question:
I see different sources do this differently so I wanted to know witch one to stick with and what is better:
should I use the "using namespace std;" OR on every line it should look like "std::cout << " and so on
Thanks a lot
-Emo
Re: using namespace or std:: ?
It really depends. For a small project, go ahead and through the entire namespace in there. Chances are you won't have a naming conflict. In a large project, you probably wont have a naming conflict either, but the chances are a lot greater.
Anyway, There is a third option ;) . You can pick certain items from the namespace to use:
Code:
using std::cout;
using std::cin;
Re: using namespace or std:: ?
I would suggest never to use a using namespace statement instead of a header file.
Re: using namespace or std:: ?
There's just one rule, everything else is a matter of taste.
The rule is: never use using at the top level of a header file.