(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

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

Slow performance first queries on SQL Azure -

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