|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2005-07-15 05:02:01
Aleksey Gurtovoy <agurtovoy_at_[hidden]> writes:
> David Abrahams <dave_at_[hidden]> writes:
>
>> 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?
>
> OK, here's a argument against: requiring the semicolon makes it
> impossible to define a macro that expands to nothing.
Okay, that's a valid argument when the macro is just being used as a
workaround, but in this case it's a convenience macro to stand in for
a couple of declarations. If you use it, you want it to have an
effect everywhere.
In any case, I see that particular case as being taken care of by the
"where possible" clause. If the author decides that the macro (plus
whatever trailing semicolon) has to be able to expand to nothing,
requiring a trailing semicolon is obviously not practical.
-- Dave Abrahams Boost Consulting www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk