6 ms·
Because a macro in C/C++ is just text expansion, the given implementation will evaluate its arguments more than once, which will not be obvious at the "call" si
by copascetic 11y ago
Because a macro in C/C++ is just text expansion, the given implementation will evaluate its arguments more than once, which will not be obvious at the "call" site and could have unintended consequences if the expressions have side-effects.
- azinman2 11y agoIs there another way to do it as a macro that avoids this? How do you have temporary variables potentially in the middle of a larger expression, e.g. if (min(a,b) == 3) {...}