I use preprocessor macros to declare some duplicate variables, in particular:
QuitCallbackType quitCallback; LossCallbackType lossCallback; PauseCallbackType pauseCallback; KeyCallbackType keyCallback; MouseCallbackType mouseCallback;
I would like to use a preprocessor macro for this, a la
CREATE_CALLBACK_STORAGE(quit) CREATE_CALLBACK_STORAGE(loss) CREATE_CALLBACK_STORAGE(pause) CREATE_CALLBACK_STORAGE(key) CREATE_CALLBACK_STORAGE(mouse)
where it will look like this:
#define CREATE_CALLBACK_STORAGE(x) capitalize(x)##CallbackType x##CallBack;
Is there a way to do this, so I don’t need to pass both uppercase and lowercase versions of each name?
I understand that there is not much to type for using macros, but the problem itself has begun to intrigue me.
c ++ macros
bfops
source share