J
Joseph Turian
When does initialization of static member variables occur?
In the following code fragment, is m_start_time automatically
initialized right before main()?
[This is the desired effect.]
Or is m_start_time uninitialized until the first time I use a static
method in stats?
Thanks
Joseph
==
stats.H:
class stats {
...
static time_t m_start_time;
};
==
stats.C:
time_t get_start_time() {
time_t t;
time(&t);
return t;
}
time_t stats::m_start_time = get_start_time();
==
In the following code fragment, is m_start_time automatically
initialized right before main()?
[This is the desired effect.]
Or is m_start_time uninitialized until the first time I use a static
method in stats?
Thanks
Joseph
==
stats.H:
class stats {
...
static time_t m_start_time;
};
==
stats.C:
time_t get_start_time() {
time_t t;
time(&t);
return t;
}
time_t stats::m_start_time = get_start_time();
==