Click here to Skip to main content
15,917,859 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Virtual Destructors in COM? Pin
ThatsAlok4-Nov-04 19:03
ThatsAlok4-Nov-04 19:03 
AnswerRe: Virtual Destructors in COM? Pin
User 2155974-Nov-04 20:21
User 2155974-Nov-04 20:21 
GeneralRe: Virtual Destructors in COM? Pin
ThatsAlok4-Nov-04 22:39
ThatsAlok4-Nov-04 22:39 
GeneralWave Sample Rate Pin
Anthony98874-Nov-04 14:30
Anthony98874-Nov-04 14:30 
QuestionShould I make namespace std global? Pin
Link26004-Nov-04 14:04
Link26004-Nov-04 14:04 
AnswerRe: Should I make namespace std global? Pin
Christian Graus4-Nov-04 14:14
protectorChristian Graus4-Nov-04 14:14 
AnswerRe: Should I make namespace std global? Pin
Ryan Binns4-Nov-04 18:15
Ryan Binns4-Nov-04 18:15 
AnswerRe: Should I make namespace std global? Pin
Link26004-Nov-04 19:26
Link26004-Nov-04 19:26 
Okay, so if I use using namespace std;, does that mean the program will compile everything named under namespace std? Many people recommend not to make the namespace std global, but some say it doesn't matter. But I usually do the second way, typing explicitly using::string, using::cout......until I read the newly released book from Andrei Alexandrescu (highly repected person in the field), the book named C++ coding standard. (ISBN: 0-321-11358-6)

Here is a quote from the book:
But here's the common trap: Many people think that using declarations issued at namespace level (for example, using N::Widge) are safe. They are not. They are at least as dangerous, and in a subtler and more insidious way.

After reading this, I was thinking, am I doing the right way? So I thought I would ask people here how they are doing it.

<br />
// Implementation file<br />
#include <iostream><br />
using namespace std;<br />
<br />
int main()<br />
{<br />
// code<br />
return 0;<br />
}<br />


or should I do this:

<br />
// Implemenation file<br />
#include <iostream><br />
using::cout;<br />
using::cin;<br />
using::endl;<br />
<br />
int main()<br />
{<br />
//code<br />
<br />
return 0;<br />
}<br />


-----------------------------
C++ without virtual functions is not OO. Programming with classes but without dynamic binding is called "object based", but not "object oriented".
GeneralRe: Should I make namespace std global? Pin
Ryan Binns4-Nov-04 20:38
Ryan Binns4-Nov-04 20:38 
GeneralRe: Should I make namespace std global? Pin
Link26004-Nov-04 21:29
Link26004-Nov-04 21:29 
GeneralRe: Should I make namespace std global? Pin
Mike Beckerleg4-Nov-04 22:39
Mike Beckerleg4-Nov-04 22:39 
GeneralRe: Should I make namespace std global? Pin
Antony M Kancidrowski4-Nov-04 23:33
Antony M Kancidrowski4-Nov-04 23:33 
GeneralRe: Should I make namespace std global? Pin
Ryan Binns5-Nov-04 1:36
Ryan Binns5-Nov-04 1:36 
GeneralAutomatically unlock workstation Pin
xueshunnai4-Nov-04 11:59
xueshunnai4-Nov-04 11:59 
GeneralRe: Automatically unlock workstation Pin
Ryan Binns4-Nov-04 18:19
Ryan Binns4-Nov-04 18:19 
GeneralProperty Window Pin
goacas4-Nov-04 9:34
goacas4-Nov-04 9:34 
Questionstarting an image project in VC++? Pin
ashsri4-Nov-04 9:33
ashsri4-Nov-04 9:33 
AnswerRe: starting an image project in VC++? Pin
ThatsAlok4-Nov-04 17:10
ThatsAlok4-Nov-04 17:10 
GeneralHelp me debug SetDIBitsToDevice Pin
Budric B.4-Nov-04 8:39
Budric B.4-Nov-04 8:39 
GeneralOops found my problem Pin
Budric B.4-Nov-04 8:42
Budric B.4-Nov-04 8:42 
GeneralRe: Oops found my problem Pin
John R. Shaw5-Nov-04 14:34
John R. Shaw5-Nov-04 14:34 
GeneralSmall icons Pin
lillah4-Nov-04 8:21
lillah4-Nov-04 8:21 
GeneralRe: Small icons Pin
ThatsAlok4-Nov-04 17:12
ThatsAlok4-Nov-04 17:12 
GeneralRe: Small icons Pin
lillah4-Nov-04 21:13
lillah4-Nov-04 21:13 
GeneralRe: Small icons Pin
ThatsAlok4-Nov-04 22:18
ThatsAlok4-Nov-04 22:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.