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

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;
}

Very cool - thanks!

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.