Dhruv_gheewala's blog

By Dhruv_gheewala, history, 3 weeks ago, In English,

can anyone please help me !!

what does this macro do ?

MACRO :

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif
 
 
 
 
  • Vote: I like it
  • -1
  • Vote: I do not like it

»
3 weeks ago, # |
  Vote: I like it +21 Vote: I do not like it

It basically let's people have debug prints that only show up when running the code locally, but won't show up when submitting. It avoids the problem of commenting debug prints in and out or forgetting to remove them before submitting.

I'm not gonna explain how it works, you have Google if you want to understand #ifdef and #define.

Also please use an even bigger font next time, the bigger the font the more answers you get.

  • »
    »
    3 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    yeah, i will make font more bigger.

    btw i haven't noticed the size of font so by mistake i got this size of font.

    • »
      »
      »
      3 weeks ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      The hash sign causes it. If you include it in code block it will be fine. But seriously though, make font even bigger next time.

»
3 weeks ago, # |
  Vote: I like it +1 Vote: I do not like it

Auto comment: topic has been updated by Dhruv_gheewala (previous revision, new revision, compare).

»
3 weeks ago, # |
  Vote: I like it +1 Vote: I do not like it

it's for debugging