Boost logo

Boost :

From: Jeremy Siek (jsiek_at_[hidden])
Date: 2001-03-05 09:44:49


In this case I was trying to ensure that the class specialization created
by the macro occured in the appropriate namespace. If instead the burden
is placed on the user, then it would not be a problem to have the trailing
";".

The do-while trick doesn't apply to this case since the macro is for use
in global scope, to create a class definition.

On Mon, 5 Mar 2001, Michiel Salters wrote:

Michie>
Michie> -----Original Message-----
Michie> From: David Abrahams [mailto:abrahams_at_[hidden]]
Michie> Sent: Monday, March 05, 2001 2:25 PM
Michie> To: boost_at_[hidden]
Michie> Subject: Re: [boost] Named template parameters
Michie>
Michie>
Michie> > A small issue with the code - we don't need a semicolon after
Michie> > BOOST_NAMED_TEMPLATE_PARAMETER macro invocation, and CW6.1 issues the
Michie> > "illegal empty declaration" warning for it:
Michie>
Michie> > Where possible, I like to arrange macros so that the trailing semicolon is
Michie> > required. Can that be done?
Michie>
Michie> > -Dave
Michie>
Michie> The traditional trick is
Michie>
Michie> # define X(args) do { \
Michie> ... \
Michie> ... \
Michie> while (false)
Michie>
Michie> This executes the body once, requires a ; and should
Michie> compile to a NO-OP.
Michie>
Michie>
Michie> Regards,
Michie> Michiel Salters
Michie>
Michie>
Michie>
Michie> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
Michie>
Michie>
Michie>

----------------------------------------------------------------------
 Jeremy Siek www: http://www.lsc.nd.edu/~jsiek/
 Ph.D. Candidate email: jsiek_at_[hidden]
 Univ. of Notre Dame work phone: (219) 631-3906
----------------------------------------------------------------------


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