-1

I encountered this macros definition in a C project. I face problems expanding the macro. Here it is:

#define PT_THREAD(name_args) char name_args

#define PROCESS_THREAD(name, ev, data)              \
static PT_THREAD(process_thread_##name(struct pt *process_pt,   \
                   process_event_t ev,  \
                   process_data_t data))

Some help? Thank you.

mch
  • 9,424
  • 2
  • 28
  • 42
Radoslaw Krasimirow
  • 1,833
  • 2
  • 18
  • 28
  • 2
    Just about all compilers are capable of stopping after the preprocessor stage, so you could easily see for yourself what the macro expands to. – Some programmer dude Oct 26 '15 at 10:11
  • 2
    Possible duplicate of [Seeing expanded C macros](http://stackoverflow.com/questions/985403/seeing-expanded-c-macros) – Magisch Oct 26 '15 at 10:18

1 Answers1

3

You can run gcc -E to get the resulting code after the preprocessor.

Running this on PROCESS_THREAD(foo,bar,baz) results in:

static char process_thread_foo(struct pt *process_pt, process_event_t bar, process_data_t baz)
m.s.
  • 16,063
  • 7
  • 53
  • 88