Блог пользователя Hacker-M

Автор Hacker-M, 4 года назад, По-английски

Hi !

I was googling how to debug faster without writing many cerrs and I found out this blog, then I found out that I don't want to write this much code in my default code on my computer then when I wan in tourist's live stream I saw he is using a local include and I want to use something like that, can anybody pls help, Btw I am using sublime text.

This is the code I want to make include for it

I just want to write this part in my code when I am practicing :

#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
  • Проголосовать: нравится
  • -12
  • Проголосовать: не нравится

»
4 года назад, скрыть # |
 
Проголосовать: нравится +13 Проголосовать: не нравится

Create a debug.h file and put your debugging template there and include it's path inside your template.

debug.h
If you include path like this, you don't need to comment out debug statements while submitting
»
3 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Can you explain me what's the meaning of this #define debug(x...) and why have you use dots in front of x (x...) ?