I have the following problem:
extern void func_name(const char *f); #define EXPECT(f) func_name(#f) #define foo bar void main() { EXPECT(foo); } So, the
EXPECT(foo); will be actually evaluated to
func_name("foo"); What I actually need is to convert 'foo' to 'bar', i.e. the code to become
func_name("bar"); So I kind of want to do this:
#define "foo" "bar" But this does not work, because macro names must be identifiers. I also tried to find a way to change the preprocessor precedence, so my macro will be replaced first, but didn't find a way.
The perfect solution will not change main() at all.
void main()is correct, its author has lied to you. Get a better book. The correct definition isint main(void).