Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • While very clever, this causes one to be bombarded with compiler warnings on potential dangling else. Commented Mar 26, 2015 at 19:20
  • 2
    You usually use macros to create a contained environment, that is, you never use a break (or continue) inside a macro to control a loop that started/ended outside, that’s just bad style and hides potential exit points. Commented Dec 21, 2016 at 11:51
  • There's also a preprocessor library in Boost. What is mind-blowing about it? Commented Jun 1, 2017 at 8:45
  • The risk with else ((void)0) is that someone might be writing YOUR_MACRO(), f(); and it will be syntactically valid, but never call f(). With do while it's a syntax error. Commented Jun 7, 2019 at 20:42
  • @melpomene so what about else do; while (0)? Commented Aug 15, 2019 at 2:29