I want to add some code before every function call to do some checking. The only way I know is:
#define SOME_CODE printf(\"doing something...\"); class test
As someone said in a comment, it is a typical use case of aspect / feature programming. You can try this to use aspect / feature programming with c++.
my2c