Boost logo

Boost :

From: Dave Steffen (dgsteffen_at_[hidden])
Date: 2005-07-19 15:46:58


Jason McCarty writes:
> Paul Mensonides wrote:
> > Incidentally, this should automatically be:
> >
> > if (something) {
> > MACRO_INVOCATION(); // semicolon argument aside
> > }
> > else
> > ...
> >
> > Because if the macro expands to statement, it could just as
> > easily expand to a series of statements.
>
> But doesn't everybody wrap those in do-while loops? I.e.,
> #define FOO do { bar; baz; } while (false)

 That's only for macros which are used like function calls. Macros
 that, for example, define families of related functions, can't use
 that trick.

 There _is_ a trick that can be used if you want those kind of macros
 to be followed by a semicolon; all the recent heat around this topic
 amounts to whether or not that should be done.

----------------------------------------------------------------------
Dave Steffen, Ph.D. "There are two ways to write error-free
Software Engineer IV programs; only the third one works."
Numerica Corporation
ph (970) 419-8343 x27 "Pie are not square. Pie are round.
fax (970) 223-6797 Cornbread are square"
dgsteffen_at_[hidden] ... anon (usenet)
___________________
Numerica Disclaimer:
This message and any attachments are intended only for the individual
or entity to which the message is addressed. It is proprietary and
may contain privileged information. If you are neither the intended
recipient nor the agent responsible for delivering the message to the
intended recipient, you are hereby notified that any review,
retransmission, dissemination, or taking of any action in reliance
upon, the information in this communication is strictly prohibited,
and may be unlawful. If you feel you have received this communication
in error, please notify us immediately by returning this Email to the
sender and deleting it from your computer.


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