| View previous topic :: View next topic |
| Author |
Message |
407 Master Cheater
Reputation: 0
Joined: 25 Oct 2007 Posts: 357
|
Posted: Wed Jan 05, 2011 1:14 am Post subject: Using namespace std |
|
|
Can someone tell me the difference between
| Code: | using namespace std
cout << ... |
and
Is it all just preference?
|
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Wed Jan 05, 2011 4:47 am Post subject: |
|
|
| nothing.
|
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Wed Jan 05, 2011 12:54 pm Post subject: |
|
|
Like Slov said, nothing. Adding the 'using namespace' for things like std just make it so you don't have to type std:: in front of anything that is part of that namespace. The functions are still exactly the same though, it is just a convenience type thing.
_________________
- Retired. |
|
| Back to top |
|
 |
NoMercy Master Cheater
Reputation: 1
Joined: 09 Feb 2009 Posts: 289
|
Posted: Fri Jan 07, 2011 4:54 am Post subject: |
|
|
Some book are saying, if you use using namespace std; you do not use the namespace usefull, since it would be a global variable, you can do it better inside a function or use namespacename::
Note, this is what Bjarne Stroustrup wrote in his book.
|
|
| Back to top |
|
 |
|