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

C / C++ / MFC

 
QuestionChanging text color in a record list for one item Pin
LCI6-Sep-05 11:27
LCI6-Sep-05 11:27 
Questionstatic constructors ? Pin
zildjohn016-Sep-05 10:38
zildjohn016-Sep-05 10:38 
Answer[Message Deleted] Pin
Neagoe Gabriel6-Sep-05 11:07
Neagoe Gabriel6-Sep-05 11:07 
AnswerRe: static constructors ? Pin
Anonymous6-Sep-05 11:09
Anonymous6-Sep-05 11:09 
GeneralRe: static constructors ? Pin
Jörgen Sigvardsson6-Sep-05 11:33
Jörgen Sigvardsson6-Sep-05 11:33 
GeneralRe: static constructors ? Pin
Christian Graus6-Sep-05 11:55
protectorChristian Graus6-Sep-05 11:55 
AnswerRe: static constructors ? Pin
Christian Graus6-Sep-05 11:14
protectorChristian Graus6-Sep-05 11:14 
AnswerRe: static constructors ? Pin
cmk7-Sep-05 2:48
cmk7-Sep-05 2:48 
Aside from creating an elaborate framework, or initializing all globals/statics in an init function your only real option is through the use of #pragma init_seg().

The pragma specifies when the global/static variables in a source file (.c/.cpp) are to be initialized. There are 3 defined groups: compiler, lib, user that are initialized in that order.

e.g.
Given (in various .h files):
extern int g_a;
class C {...}; // uses g_a
extern C g_c;

fileA.cpp (source with g_a):
#pragma init_seg(lib)
int g_a = 0;

fileC.cpp (source for class C):
#pragma init_seg(user)
C g_c();


Normally it would be a crap shoot on whether g_a is initialized before g_c.
However, with the pragma's, the compiler will make sure g_a = 0 before g_c is constructed.


...cmk

Save the whales - collect the whole set
AnswerRe: static constructors ? Pin
Hugo González Castro26-Nov-11 20:03
professionalHugo González Castro26-Nov-11 20:03 
QuestionBrowse/Open dialog box Pin
bugDanny6-Sep-05 10:14
bugDanny6-Sep-05 10:14 
AnswerRe: Browse/Open dialog box Pin
Ravi Bhavnani6-Sep-05 10:38
professionalRavi Bhavnani6-Sep-05 10:38 
AnswerRe: Browse/Open dialog box Pin
David Crow6-Sep-05 17:10
David Crow6-Sep-05 17:10 
AnswerRe: Browse/Open dialog box Pin
ThatsAlok6-Sep-05 18:59
ThatsAlok6-Sep-05 18:59 
QuestionRead Files Pin
RedDragon2k6-Sep-05 10:11
RedDragon2k6-Sep-05 10:11 
AnswerRe: Read Files Pin
bugDanny6-Sep-05 10:24
bugDanny6-Sep-05 10:24 
GeneralRe: Read Files Pin
RedDragon2k6-Sep-05 11:02
RedDragon2k6-Sep-05 11:02 
GeneralRe: Read Files Pin
Anonymous6-Sep-05 13:54
Anonymous6-Sep-05 13:54 
GeneralRe: Read Files Pin
bugDanny7-Sep-05 8:26
bugDanny7-Sep-05 8:26 
Answer[Message Deleted] Pin
kakan6-Sep-05 20:39
professionalkakan6-Sep-05 20:39 
AnswerRe: Read Files Pin
kakan6-Sep-05 20:40
professionalkakan6-Sep-05 20:40 
GeneralRe: Read Files Pin
RedDragon2k7-Sep-05 2:49
RedDragon2k7-Sep-05 2:49 
GeneralRe: Read Files Pin
kakan8-Sep-05 0:23
professionalkakan8-Sep-05 0:23 
GeneralRe: Read Files Pin
RedDragon2k8-Sep-05 1:02
RedDragon2k8-Sep-05 1:02 
GeneralRe: Read Files Pin
kakan8-Sep-05 1:44
professionalkakan8-Sep-05 1:44 
QuestionMinimize RAM-usage in MFC? Pin
Gadjuka6-Sep-05 10:06
Gadjuka6-Sep-05 10: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.