News for hackers. Stuff that matters.
Re:〔Coding style〕Reasons to add the curly brackets behind if... by pwdisswordfish2 on Tuesday October 08, 2019 @02:28AM (#21189357)
Multi-line macros should be wrapped in “do { ... } while (0)” anyway. Not only does it ensure that control flow constructs apply to them atomically as intended, regardless if they use curly brackets or not, but also isolates any potential variable declarations into their own scope, ensures that all uses of the macro are followed by a semicolon and gives you an early exit construct for free (“break;”).

There are no comments on this comment yet.