i'm looking @ code regarding scheduling queryperformancefrequency. can't understand what's going on here. why rvalue wrapped in parenthesis? large_integer struct, initializing require {} instead, totally confused line. queryperformancefrequency returns bool, too.
// initialize resolution of timer large_integer timer::m_freq = (queryperformancefrequency(&timer::m_freq), timer::m_freq);
the header contains timer struct private member:
static large_integer m_freq;
it's bad. bad commenters have said.
given queryperformancefrequency should cheap call make, there's little need cache global (static) variable.
do instead.
remove
static
declaration m_freq variable in class declaration.initialize
m_freq
in constructor oftimer
class.
example:
timer::timer() { bool result = queryperformancefrequency(&m_freq); if (result==false) { // optional - set error condition. it's not // original code handling potential error either } }
Comments
Post a Comment