Hacker News new | ask | show | jobs
by Someone 2708 days ago
It enables you to invoke the macro as if it were an expression statement consisting of a function call, regardless of where it appears.

For details, see http://c-faq.com/cpp/multistmt.html:

1 comments

In particular, a single statement. I'm sure the link covers it, but:

    if (foo)
      MULTI_LINE_MACRO;
Breaks without some wrapper like if (1) { A; B; } or do { A; B; } while (0):

    if (foo)
      A;
      B;  // oops, unconditional (e.g., "goto fail")
It also gives you a nice scope to keep local variables in, but there are other ways to accomplish that too.
Yeah, that's a good point too.