Click here to Skip to main content
15,920,110 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralCListCtrl::EnsureVisible Pin
Poul Haahr Klemmensen14-Aug-02 1:33
Poul Haahr Klemmensen14-Aug-02 1:33 
GeneralafxDump and CMap Pin
-Dy14-Aug-02 1:07
-Dy14-Aug-02 1:07 
QuestionActivating IE proxy settings...? Pin
Tommy Svensson14-Aug-02 0:50
Tommy Svensson14-Aug-02 0:50 
AnswerRe: Activating IE proxy settings...? Pin
Brian Delahunty14-Aug-02 1:19
Brian Delahunty14-Aug-02 1:19 
GeneralRe: Activating IE proxy settings...? Pin
Tommy Svensson14-Aug-02 1:31
Tommy Svensson14-Aug-02 1:31 
GeneralRe: Activating IE proxy settings...? Pin
Todd Smith14-Aug-02 5:16
Todd Smith14-Aug-02 5:16 
AnswerRe: Activating IE proxy settings...? Pin
Tommy Svensson14-Aug-02 21:58
Tommy Svensson14-Aug-02 21:58 
GeneralInitialising static const strings in VC7 Pin
Rob Caldecott14-Aug-02 0:27
Rob Caldecott14-Aug-02 0:27 
I would like to initialize my static const variables as part of the declaration in the header (I am using VS7) - this seems to work fine for ints, but not for LPCTSTRs. For example:

class CFoo
{
static const int m_nStatic = 1; // This works
static const LPCTSTR m_pszStatic = _T("Hello, world!"); // This fails
static const char* m_pszStatic2 = "Test"; // This fails
};

In the above sample, I get the following errors when attempting to initialise the strings:

error C2864: 'm_psz...' : only const static integral data members can be initialized inside a class or struct

Obviously I can initialize the static strings outside of the class, i.e.:

LPCTSTR::CFoo m_pszStatic = _T("Hello, world!");

But I have always found this method cumbersome. I am a big fan of Scott Meyers Effective C++ book(s) and he cites example code that will initialise strings in the class declaration so could this be an MS compiler-ism? Perhaps there is a pragma?



Phew, for a minute there I lost myself.
GeneralRe: Initialising static const strings in VC7 Pin
Tomasz Sowinski14-Aug-02 0:34
Tomasz Sowinski14-Aug-02 0:34 
GeneralRe: Initialising static const strings in VC7 Pin
Rob Caldecott14-Aug-02 0:38
Rob Caldecott14-Aug-02 0:38 
QuestionHow to implement voice chat Pin
Deepesh13-Aug-02 23:22
Deepesh13-Aug-02 23:22 
AnswerRe: How to implement voice chat Pin
JohnnyMkhael13-Aug-02 23:27
sussJohnnyMkhael13-Aug-02 23:27 
GeneralRe: How to implement voice chat Pin
Deepesh13-Aug-02 23:52
Deepesh13-Aug-02 23:52 
AnswerRe: How to implement voice chat Pin
Brian Delahunty13-Aug-02 23:35
Brian Delahunty13-Aug-02 23:35 
QuestionWhat is Socket Notification Sink ? Pin
s_k13-Aug-02 23:12
s_k13-Aug-02 23:12 
Generalwinsock Pin
Zizilamoroso13-Aug-02 23:03
Zizilamoroso13-Aug-02 23:03 
GeneralRe: winsock Pin
Niklas L13-Aug-02 23:10
Niklas L13-Aug-02 23:10 
GeneralRe: winsock Pin
Zizilamoroso13-Aug-02 23:17
Zizilamoroso13-Aug-02 23:17 
GeneralLast reliable time at the end of the application Pin
s_k13-Aug-02 23:00
s_k13-Aug-02 23:00 
GeneralRe: Last reliable time at the end of the application Pin
Tomasz Sowinski13-Aug-02 23:13
Tomasz Sowinski13-Aug-02 23:13 
GeneralLimiting scope of 'using namespace' Pin
Niklas L13-Aug-02 22:30
Niklas L13-Aug-02 22:30 
GeneralRe: Limiting scope of 'using namespace' Pin
Tomasz Sowinski13-Aug-02 22:38
Tomasz Sowinski13-Aug-02 22:38 
GeneralRe: Limiting scope of 'using namespace' Pin
Niklas L13-Aug-02 22:49
Niklas L13-Aug-02 22:49 
GeneralRe: Limiting scope of 'using namespace' Pin
Tomasz Sowinski13-Aug-02 23:04
Tomasz Sowinski13-Aug-02 23:04 
GeneralRe: Limiting scope of 'using namespace' Pin
Niklas L13-Aug-02 23:06
Niklas L13-Aug-02 23:06 

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.