Boost logo

Boost :

From: Rob Stewart (stewart_at_[hidden])
Date: 2005-07-14 14:06:37


From: David Abrahams <dave_at_[hidden]>
>
> 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?

I prefer that such macros be written to require the client to
supply the semicolon. It doesn't confuse auto-indentation logic,
for one thing. For another, it *looks* like a function call,
even if it isn't one, so completing the facade keeps it neat in
the mind.

If such macros (generally, not necessarily this one) include the
semicolon, so the client needn't, some will add a semicolon
anyway because it looks like a function call. Then, some
compilers warn about the extra semicolon.

-- 
Rob Stewart                           stewart_at_[hidden]
Software Engineer                     http://www.sig.com
Susquehanna International Group, LLP  using std::disclaimer;

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk