C++ macro string concatenation -


this macro seems replace snmpwritefunc(w,x,y,z,q) function returning static type snmpwriteobject, perhaps instead overload of snmpwriteobject method? quite obscure me, grateful of 1 more experienced in area!

#define snmpwritefunc(w,x,y,z,q) static snmpwriteobject r##w(x,y,z,q); 

it's convenience macro generating number of similar function prototypes, if write e.g.

snmpwritefunc(foo,int,int,int,int) snmpwritefunc(bar,char,float,char,float) snmpwritefunc(blech,int,char,float,int) 

it expanded to:

static snmpwriteobject rfoo(int,int,int,int); static snmpwriteobject rbar(char,float,char,float); static snmpwriteobject rblech(int,char,float,int); 

note ## commonly known token pasting operator.

note macro , examples above not c++-specific - c code.


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -