![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#11 | |
|
Hobbyist Programmer
Join Date: Jun 2005
Location: MA, US
Posts: 204
Rep Power: 4
![]() |
Quote:
__________________
"A stupid man's report of what a clever man says can never be accurate, because he unconciously translates what he hears into something he can understand." - B. Russell http://web.bryant.edu/~srk2 |
|
|
|
|
|
|
#12 |
|
Hobbyist Programmer
|
not worth it in wat ways??
__________________
From the bottom of the stone steps... ...i'm calling still. |
|
|
|
|
|
#13 | |
|
Expert Programmer
Join Date: May 2005
Location: East Lansing, MI
Posts: 663
Rep Power: 4
![]() |
Quote:
#include <iostream>
int main()
{
sdt::cout<<"Hello World!\n";
return 0;
}now you can get rid of std by using namespace std but is it worth it in this case to add a full line of code to get rid of three letters? |
|
|
|
|
|
|
#14 |
|
Hobbyist Programmer
|
Ok i get it now... :p
thanx guys ![]()
__________________
From the bottom of the stone steps... ...i'm calling still. |
|
|
|
|
|
#15 | |
|
Professional Programmer
Join Date: Apr 2005
Location: London, England
Posts: 459
Rep Power: 4
![]() |
Quote:
It's silly that every single tutorial feeds you the use of "using namespace std;" as the norm thing to do. It clogs up the global namespace. You definitely don't know the name of every single function/class/typedef the standard library provides you with. You'll no doubt get name conflicts with variable names, function names, etc. At least with the "using std::cout" syntax you know precisely what you're including into the global namespace. |
|
|
|
|
|
|
#16 | |
|
Expert Programmer
Join Date: May 2005
Location: East Lansing, MI
Posts: 663
Rep Power: 4
![]() |
Quote:
It is really a matter of personal choice IMO. |
|
|
|
|
|
|
#17 |
|
PFO God In Training
![]() Join Date: Jun 2005
Location: near St Louis, MO. (USA)
Posts: 600
Rep Power: 4
![]() |
I'v never had a problem with "usng namespace std" either. Who cares that it causes the compiler to do extra stuff? use precompiled headers and you will never even notice the compile-time difference.
|
|
|
|
|
|
#18 |
|
Hobbyist Programmer
|
I think i will start using "using namspace std;" from today.
__________________
From the bottom of the stone steps... ...i'm calling still. |
|
|
|
|
|
#19 | |
|
Professional Programmer
Join Date: Apr 2005
Location: London, England
Posts: 459
Rep Power: 4
![]() |
Quote:
Sure, it's personal choice, just like shooting yourself in the foot is a personal choice. The bad things is that to the uninformed this "personal choice" of yours is being passed of as the Right Thing To Do (tm). Hence me now recommending you Google and see what other programmers recommend. You'll see that in the vast majority of cases, their personal choice concurs with mine. My £0.02. |
|
|
|
|
|
|
#20 | |
|
Expert Programmer
Join Date: May 2005
Location: East Lansing, MI
Posts: 663
Rep Power: 4
![]() |
Cerulean, you actually scanned all the 245,000 google results for using namespace std and determined that
Quote:
I'll continue "using namespace std;", not because you don't like it, but because you don't have any hard evidence as about how "DANGEROUS" it can be. Clearly the naming is not a problem, also functions can be identified by their arguments if the names are the same. Now I know you will not be using namespace std, but just to save you the trouble of typing std:: before every cout and cin call, try "using std::cin" and "using std::cout". |
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|