Question.6
Two approaches to a MAX utility:
MAX
Macro:
#define MAX(a,b) ((a)>(b)?(a):(b))
Template:
template<typename T> constexpr T max_val(T a, T b) { return (a>b)?a:b; }
A developer calls MAX(i++, j). What happens?
MAX(i++, j)
Select Answer
Both versions evaluate i++ once
i++
Both versions evaluate i++ twice
The macro performs a double increment
macro
increment
The template performs a double increment
template