Created
March 10, 2014 00:15
-
-
Save ygabo/9457195 to your computer and use it in GitHub Desktop.
For pretty debug information on the callstack.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static int g_infoStackDepth = 0; | |
static vector<string> g_infoStack; | |
const int MaxInfoLength = 2056; | |
void push_info_stack(const string str) | |
{ | |
g_infoStack.push_back(str); | |
} | |
void pop_info_stack() | |
{ | |
g_infoStack.pop_back(); | |
} | |
class InfoPushPopHelper | |
{ | |
public: | |
InfoPushPopHelper(const string string) | |
{ | |
push_info_stack(string); | |
} | |
~InfoPushPopHelper() | |
{ | |
pop_info_stack(); | |
} | |
}; | |
#define INFO( format, ... ) \ | |
char buffer[MaxInfoLength + 1]; \ | |
_snprintf_s(buffer, MaxInfoLength + 1, format, __VA_ARGS__); \ | |
InfoPushPopHelper infoPushPop(buffer); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment