Question

I have a bunch of generated functions from a supplier's tool are required to be defined by me. Since the inner functionality of each and every one of these functions are exactly the same, I figured I could use a macro to make my life easier.

Here is the offending warning:

pasting "<function_name>" and "(" does not give a valid preprocessing token

Now, I define my macro as follows:

#define HANDLE_FUNCTION(x)               \
  void <function_prefix>_ ## x ## (void) \
  {                                      \
    x ## _Flag = TRUE;                   \
  }

In my code I then write:

HANDLE_FUNCTION(fn1)
HANDLE_FUNCTION(fn2)

...and so on

Any thoughts on why this occurs?

Was it helpful?

Solution

Remove the second ##, it has no use (you don't want to make one symbol of function_name().

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top