e.g.:
#define TEST_RUN(_retType, _funcName,_paramList)
({
_retType (*funcPtr)(_paramList) = _funcName;
_retType a = funcPtr;
std::cout << a << std::endl;
})
and I pass to this :
void someFunc(){
std::string retType = "int";
std::string paramList = "int, int";
std::string funcName = foo;
TEST_RUN(retType, funcName, paramList);
}
Function foo :
int foo( int a, int b){
return a>b?a:b;
}
The basic idea is to reate a variable param list and return type for a function pointer for a c98 compiler
Aucun commentaire:
Enregistrer un commentaire