Original Post
I though about something that could be quite interesting, but don't know if it's possible at all... For debugging purpose, I would like to build and execution stack without adding explicit code each time I enter/leave a function or class method. To achieve this, I though I could just 'replace' the curly brackets '{' & '}' by some code that would build the stack of execution with the help of __FUNCTION__. To replace the brackets, I can do this, but it's really very ugly... Well... it works, but I would like to be able to do something like this... Well... it doesn't work and tells me there's a syntax error with those '#define { ...' and '#define } ...'. I'm looking for a workaround, if there's any, or an alternative to my idea.
#define BRACKET_OPEN { someStackFunc(__FUNCTION__);
#define BRACKET_CLOSE someStackFunc(__FUNCTION__); }
void foo() BRACKET_OPEN
// ...
BRACKET_CLOSE
#define BRACKET_OPEN { someStackFunc(__FUNCTION__);
#define BRACKET_CLOSE someStackFunc(__FUNCTION__); }
#define { BRACKET_OPEN
#define } BRACKET_CLOSE
void foo() {
// ...
}