0

Is there a way to see what a macro gets expanded to?

I tried to put it in quotes and use printf, but of course printf just printed exactly the string.

The result of:

#define SetMacro(name,type) \
virtual void Set##name (type _arg)

int main()
{
  printf("SetMacro(Test, int)");
}

is SetMacro(Test,int) .

What I want to see is: virtual void SetTest(int _arg) .

Is this possible?

Thanks!

Dave

Edited by daviddoria: n/a

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by daviddoria
0

Using gcc?

gcc -E main.cpp

[edit]Some code...

#include <stdio.h>

#define SetMacro(name,type) \
virtual void Set##name (type _arg)

SetMacro(foo,int)
{
}

int main()
{
   return 0;
}

gcc's output:

...
virtual void Setfoo (int _arg)
{
}

int main()
{
   return 0;
}

Edited by Dave Sinkula: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.