(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

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

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -