Kiedy otrzymujesz max var, jaka jest różnica między używaniem funkcji a makro
czytając kod combase.cpp, znajduję następujące:
/* 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;
}
Nie rozumiem, dlaczego „maksymalne makro prowadzi do jednego z dwóch parametrów ocenianych dwukrotnie”?