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
What you are looking for is called "code instrumentation" and I gave a talk at GDC 2012 on manual and compiler-automated instrumentation (click here for code samples).
There are a number of ways to do what you want. Wrapper functions, Detours and Trampolines, or CAI (compiler-automated instrumentation) which is _penter() / __cyg_profile_func_enter() methods mentioned in other answers.
All of these as well as some other instrumentation methods are detailed in the PDF's linked above.