C++ and preprocessor macro gotcha
- by aaa
hello.
Appologies for yet another gotcha question.
Can you figure out what is wrong with the statement below?
gcc error states: "type name declared as function returning array".
#define MACRO(a) (a)[1]
class index {
typedef int index_type[2];
index_type& operator[](int i);
};
int k = 0;
int i = MACRO(index()[k]);
ps: is such questions are deemed too annoying, I am going to stop.