-
Heres a question
If this question seems stupid, than please just ignore it. But, I've been programming in C++ for awhile. I have seen 2 varities of coding styles, one without namespace, which I use:
Code:
cout<<"Hi there!\n";
and one with:
Code:
std::cout<<"Hi there!\n";
Heres my question, why is std namespace there? Is it really neccessary? I mean its still the same function is it not? I apologize if this question seems right-minded, but I would like to know.
-
if you are using cout without std:: you are
Code:
using namespace std;
or you are using a depreciated header such as iostream.h
many prefer to type std:: instead of using namespace std;
because then you have to remember which namespace it is
from, typing using namespace std; pretty much just lets
you do elss typing, and its a matter of opinion which you
choose to use. unless of course it the depreciated header,
in which case you should revise your technique.
also and also
-
As ILoveVectors said its a matter of choice, but the namespace std was put on the new hearder file so you can have a function/macro with the same name.
-
Oh, I see. So its just a matter of choice. I think I'll start putting "std::" now, just to develope a good habit.