K
K. Jennings
I have a function whose name should be composed of a prefix, an
underscore character and a suffix, like
xxx_f
What I would like to do is for the prefix to be fixed in a preprocessor
macro, so that the full name can be constructed later on:
#define MY_PREFIX xxx
#define FUNCTION_NAME MY_PREFIX_f
void FUNCTION_NAME(int a) ;
Of course, this does not work; in the end, the resulting function
prototype is
void MY_PREFIX_f(int a) ;
Can this be done at all, using the C preprocessor alone?
I tried with the ## operator to no avail. Alternatively, if one
defines
#define FUNCTION_NAME (MY_PREFIX)_f
then one obtains
void (xxx)_f(int a) ;
close, but no cigar.
underscore character and a suffix, like
xxx_f
What I would like to do is for the prefix to be fixed in a preprocessor
macro, so that the full name can be constructed later on:
#define MY_PREFIX xxx
#define FUNCTION_NAME MY_PREFIX_f
void FUNCTION_NAME(int a) ;
Of course, this does not work; in the end, the resulting function
prototype is
void MY_PREFIX_f(int a) ;
Can this be done at all, using the C preprocessor alone?
I tried with the ## operator to no avail. Alternatively, if one
defines
#define FUNCTION_NAME (MY_PREFIX)_f
then one obtains
void (xxx)_f(int a) ;
close, but no cigar.