【发布时间】:2012-05-22 05:01:47
【问题描述】:
阅读 combase.cpp 代码,我发现如下:
/* We have to ensure that we DON'T use a max macro, since these will typically */
/* lead to one of the parameters being evaluated twice. Since we are worried */
/* about concurrency, we can't afford to access the m_cRef twice since we can't */
/* afford to run the risk that its value having changed between accesses. */
template<class T> inline static T ourmax( const T & a, const T & b )
{
return a > b ? a : b;
}
我不明白为什么“最大宏导致其中一个参数被评估两次”?
【问题讨论】:
-
查看this question的答案。
标签: c++