[Home]
[Edit this page]
[Recent Changes]
[Special Pages]
[Help]
CppStd
For example (the Hello World Program):
The function cout, found in the header file iostream is in namespace std.
All classes in namespace std can be found in the std:: glossary.
Avoid using namespace std, as this will pollute the global namespace [1,2].
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
CppStd
(C++) std
std stands for standard. It is the namespace most common used.For example (the Hello World Program):
int main() { std::cout << "Hello world" << std::endl; return 0; }
- include <iostream>
The function cout, found in the header file iostream is in namespace std.
All classes in namespace std can be found in the std:: glossary.
Avoid using namespace std, as this will pollute the global namespace [1,2].
Code links
References
- 1) Bjarne Stroustrup. The C++ Programming Language (3rd edition). 1997. ISBN: 0-201-88954-4. Chapter C.14.15: 'Don't pollute the global namespace'
- 2) C++ FAQ Lite: http://www.parashift.com/c++-faq-lite/coding-standards.html#faq-27.5 : 27.5: Should I use using namespace std in my code? Probably not.
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
