(C/C++) how to create a macro that accepts the increment operator -


to make question precise create macro accepts variable ++ , pastes variable. in code:

#define mymacro(a, op) /* .... */ 

and if write in source file

mymacro(this->var, ++) 

the preprocessor should paste in code

this->var++; 

when trying define macro a##op , provides following error:

pasting "++" , "var" not give valid preprocessing token

is possible trying?

thanks in advance answer

you need combine tokens this:

#define mymacro(a, incrdecr) (a)incrdecr 

Comments

Popular posts from this blog

many to many - Django Rest Framework ManyToMany filter multiple values -

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

Java Entity Manager - JSON reader was expecting a value but found 'db' -