Click here to Skip to main content
15,888,293 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralPorblem Pin
engineerpilotdude13-Dec-04 12:29
engineerpilotdude13-Dec-04 12:29 
GeneralRe: Porblem Pin
Arsalan Malik13-Dec-04 19:48
Arsalan Malik13-Dec-04 19:48 
GeneralRe: Porblem Pin
namaskaaram13-Dec-04 20:34
namaskaaram13-Dec-04 20:34 
GeneralRe: Porblem Pin
Henry miller14-Dec-04 10:41
Henry miller14-Dec-04 10:41 
GeneralQuestion about static variable that define in a function Pin
nachilau13-Dec-04 10:34
nachilau13-Dec-04 10:34 
GeneralRe: Question about static variable that define in a function Pin
Joaquín M López Muñoz13-Dec-04 10:51
Joaquín M López Muñoz13-Dec-04 10:51 
GeneralRe: Question about static variable that define in a function Pin
nachilau13-Dec-04 11:11
nachilau13-Dec-04 11:11 
GeneralRe: Question about static variable that define in a function Pin
Joaquín M López Muñoz13-Dec-04 11:28
Joaquín M López Muñoz13-Dec-04 11:28 
But I want to know how C++ actualy implement this,

Well, how the compiler implements this feature is up to the compiler alone, I guess. You can assume the internally generated code will resemble in some way the following:
static bool __f_a_initialized=false;
static char __f_a_storage[sizeof(classA)];
 
void f()
{
  if(!__f_a_initialized){
    new (__f_a_storage) class A; // constructs a classA onto __f_a_storage
    __f_a_initialized=true;    
  }
 
  ...
}
Do not take this as the actual procedure implemented, it is just an approximation to what the compiler probably does. Does this answer your question?

And I want to know whether doing inline of f() will break the rule?

The rule does not break even if you declare your function inline.

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
Want a Boost forum in Code Project? Vote here[^]!
GeneralDialog box title size Pin
act_x13-Dec-04 9:34
act_x13-Dec-04 9:34 
GeneralRe: Dialog box title size Pin
Antony M Kancidrowski13-Dec-04 9:45
Antony M Kancidrowski13-Dec-04 9:45 
GeneraleMbedded Pin
su_penguin13-Dec-04 9:08
su_penguin13-Dec-04 9:08 
GeneralDirectX Init problem Pin
Andy Hunter13-Dec-04 8:55
Andy Hunter13-Dec-04 8:55 
GeneralRe: DirectX Init problem Pin
Verolix13-Dec-04 14:50
Verolix13-Dec-04 14:50 
GeneralRe: DirectX Init problem Pin
Andy Hunter14-Dec-04 2:57
Andy Hunter14-Dec-04 2:57 
GeneralPlaying sound help Pin
rikkemus13-Dec-04 8:54
rikkemus13-Dec-04 8:54 
GeneralWizards and Radio Buttons... Pin
tpbzdw13-Dec-04 8:02
tpbzdw13-Dec-04 8:02 
GeneralRe: Wizards and Radio Buttons... Pin
toxcct13-Dec-04 8:17
toxcct13-Dec-04 8:17 
GeneralRe: Wizards and Radio Buttons... Pin
tpbzdw13-Dec-04 9:25
tpbzdw13-Dec-04 9:25 
GeneralRe: Wizards and Radio Buttons... Pin
Antony M Kancidrowski13-Dec-04 9:57
Antony M Kancidrowski13-Dec-04 9:57 
GeneralRe: Wizards and Radio Buttons... Pin
tpbzdw13-Dec-04 10:14
tpbzdw13-Dec-04 10:14 
GeneralRe: Wizards and Radio Buttons... Pin
Antony M Kancidrowski13-Dec-04 10:50
Antony M Kancidrowski13-Dec-04 10:50 
GeneralRe: Wizards and Radio Buttons... Pin
toxcct14-Dec-04 4:45
toxcct14-Dec-04 4:45 
GeneralRe: Wizards and Radio Buttons... Pin
Antony M Kancidrowski13-Dec-04 10:00
Antony M Kancidrowski13-Dec-04 10:00 
GeneralRe: Wizards and Radio Buttons... Pin
toxcct14-Dec-04 4:33
toxcct14-Dec-04 4:33 
GeneralMFC ListControl Pin
RaymondM13-Dec-04 7:10
RaymondM13-Dec-04 7:10 

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.