Hi,

I have a problem in evaluating a macro in this code:

#include<iostream>
#define _A_ some
#define Func _A_Func
using namespace std;

int someFunc(int i)
{
return i;
}

int main() {

cout<<Func(1);

}

I get an error:
test.cpp: In function ‘int main()’:
test.cpp:13:13: error: ‘_A_Func’ was not declared in this scope

So the second evaluation of'A' to 'some' didn't take place, I would like to ask why there is no recurive evaluation of macros? and if there is a straight forward solution to this.

Thanks!

_A_FUNCTION is not the same as _A_FUNCTION(), read this article

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.