How to add code at the entry of every function?
<p>I want to add some code before every function call to do some checking. The only way I know is:</p>

<pre><code>#define SOME_CODE printf("doing something...");

class testObject
{
void function1()
{
 SOME_CODE
 ...
}
void function2()
{
 SOME_CODE
 ...
}
}
</code></pre>

<p>Is there a cleaner way to achieve this? I'm looking for a method so I don't have add "SOME_CODE" to every function manually.</p>
