
"David Abrahams" <dave@boost-consulting.com> wrote
I am defining a macro,
BOOST_PARAMETER_KEYWORD(tag_namespace, name)
that declares a keyword for the Parameter library. It has to be used at namespace scope. I have the option to define it so that correct usage requires a trailing semicolon, or so that the trailing semicolon is forbidden. Unfortunately I don't have the ability to make it optional. Which should I choose?
IMO there's no chance of confusing it with a function call, since a function call would be illegal in the context in which it's used, and people are naturally more likely to add a semicolon without thinking about it, and if I design the macro so that a semicolon is required it will interact more smoothly with editors and pretty-printers. So I can't see any good reason not to require the semicolon. Arguments?
We have a similar problem in typeof, and at this point semicolon is not required. This leads to all the problems with the editor that you mentioned, and, if the user does supply the (second) semicolon, some compilers emit warnings, so I am by no means happy with the situation. However, if the semicolon is required, and the user doesn't supply it, the compiler will produce an error message, which will expose implementation details of this macro, and most likely be of little help. So, the choice is actually between two evels, and I am not really sure which one is less evel. Also, I think, this problem is very generic, and once it's decided which style is prefferrable, it may be a good idea to turn it into a guideline, so that it is consistent between the Boost libraries. Regards, Arkadiy