
Chris Uzdavinis <chris@uzdavinis.com> writes:
However, I'd call this a poorly designed macro because it's misleading and error prone. My personal guidelines are:
1) when a macro is logically its own statement, then the user should provide the semicolon to aide in readability. This makes it clear that the macro is "done". Therefore, I'd write SOME_MACRO1 to have the user provide the semicolon. This requires that the macro actually be done and its effect doesn't spill into the following code.
2) when a macro is intended to modify the code that follows it, then it should not have visible trailing semicolons or they will mislead the user. It should be obvious from indentation that the macro is being applied as a prefix to the code that follows, rather than a self-contained statement.
I like your guidelines, but I think your language is a little problematic, and might reflect the thinking that Paul objects to. IOW, a macro is not a statement. Instead, a macro expansion might _generate_ a statement. -- Dave Abrahams Boost Consulting www.boost-consulting.com