473,396 Members | 1,804 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

What is std:: ?

Hi all,

Ok, my class book doesn't cover this yet I see it being used with very
basic statements such as cout. It is also covered in other C++ books in
the first program (I was skimming at Borders) so what does it actually
do? And you can imagine the results I get when putting std into google.

Thanks,

Matt
May 14 '06 #1
5 2178
* ComicCaper:
Hi all,

Ok, my class book doesn't cover this yet I see it being used with very
basic statements such as cout. It is also covered in other C++ books in
the first program (I was skimming at Borders) so what does it actually
do? And you can imagine the results I get when putting std into google.


"std::whatever" refers to a name "whatever" from the standard library.

Technically it states which namespace (namely, "std") the name is
defined in, or at least is available in.

That helps to avoid name collisions: you can have the same name, with
different meanings, in different namespaces.

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
May 14 '06 #2
ComicCaper wrote:
Ok, my class book doesn't cover this yet I see it being used with very
basic statements such as cout. It is also covered in other C++ books in
the first program (I was skimming at Borders) so what does it actually do?
And you can imagine the results I get when putting std into google.


All the Standard Library identifiers are in a namespace called std. Googling
"namespace std" with quotes gives this first good hit:

http://www.cplusplus.com/doc/tutorial/namespaces.html

You need to suspect your class and tutorial if it doesn't cover these
things. They have been the de-facto standard for >10 years now.

Whether you suspect your class or not, always learn anything - especially
C++ - from many more sources than an assigned textbook.

--
Phlip
http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!!
May 14 '06 #3
ComicCaper wrote:
Hi all,

Ok, my class book doesn't cover this yet I see it being used with very
basic statements such as cout. It is also covered in other C++ books in
the first program (I was skimming at Borders) so what does it actually
do? And you can imagine the results I get when putting std into google.

Thanks,

Matt


As to the googling part: you can easily get useful descriptions by
searching "c++ std", "std:: c++" "namespace std:: c++", etc.

I admit that the use of the abbreviation is odd. Funny in a sense that
abbreviation itself presents an embarrassing name collision--the very
thing that it tries to avoid :-)

Regards,
Ben
May 15 '06 #4
from a practical point of view. If you not already using std::cout
then you probably have a line at the top of your code ' using namespace
std' Basically this line of code tells the compiler that you are using
the standard library and wherever it sees cout it must assume you mean
std::cout.

May 15 '06 #5
In message <11*********************@y43g2000cwc.googlegroups. com>,
wg*****@gmail.com writes
from a practical point of view. If you not already using std::cout
then you probably have a line at the top of your code ' using namespace
std' Basically this line of code tells the compiler that you are using
the standard library and wherever it sees cout it must assume you mean
std::cout.


No, that would be "using std::cout;". "using namespace std;" is more
general than that. Wherever it sees a name it will now look in std _as
well as_ everywhere else it would search. If you have an object called
cout in some other namespace, it may find that instead - the rules are
complicated.

--
Richard Herring
May 16 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: SIgnOff | last post by:
What the fastest way to copy strings from file to a vector in STL?
8
by: Steven T. Hatton | last post by:
This is from ISO/IEC 14882:2003(E) §5.6 ¶4 <quote> The binary / operator yields the quotient, and the binary % operator yields the remainder from the division of the first expression by the...
6
by: Alfonso Morra | last post by:
I have written the following code, to test the concept of storing objects in a vector. I encounter two run time errors: 1). myClass gets destructed when pushed onto the vector 2). Prog throws a...
12
by: Steven T. Hatton | last post by:
I know of a least one person who believes std::ifstream::read() and std::ofstream::write() are "mistakes". They seem to do the job I want done. What's wrong with them. This is the code I...
10
by: Jim Langston | last post by:
Expected output of program: Key is: 0 String is: Hello Key is: 1 String is: Goodbye Key is: 2 String is: The end Actual output: Key is: 0 String is: The End Key is: 1 String is: Key is: 2...
6
by: Magcialking | last post by:
the following code just won't compile, ......... vector< vector< vector<int >::iterator it1=fr.begin(),it1_end=fr.end(); for(;it1!=it1_end();it1++){ ......... the message from the compliler...
2
by: dasilva109 | last post by:
Hi guys I am new to C++ and need urgent help with this part of my code for a uni coursework I have to submit by Thursday //ClientData.h #ifndef CLIENTDATA_H #define CLIENTDATA_H #include...
5
by: pkirk25 | last post by:
It looks like the Visuakl Studio Intellisense can see the various functions but its compiler cannot. I am well out of my depth with this error message. report.obj : error LNK2019: unresolved...
4
by: Vince C. | last post by:
Hi all. I can see the standard template library has changed a lot since I begun C++ 10 years ago... Now I'm facing with outputing the members of a struct, say Option, which contains 2 members...
3
by: vainstah | last post by:
Hello Guys and Galls, To start off, I have reached the solution I was looking for, but I would like comments and feedback on the solution I have reached and tips/tricks on making it more elegant....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.