Boost logo

Boost Users :

From: Dave Steffen (dgsteffen_at_[hidden])
Date: 2005-06-29 11:59:27


Bronek Kozicki writes:
> Dave Steffen <dgsteffen_at_[hidden]> wrote:
> > #define FOO(T) \
>
> #define FOO do{/* here goes your macro */} while(0)

 Yes, I've seen this in the GCC documentation. Unfortunately, it
 doesn't help if you're doing the sort of preprocessor metaprogramming
 we're doing. In one case in particular, the end result of the macro
 really is supposed to be a _function declaration_, not a section of
 code.

 In another case, it shows up from the construct

#define NUM_SIG_CONNECTION_FUNCTIONS_FOR_MEMBERS(first,last) \
  BOOST_PP_REPEAT_FROM_TO(BOOST_PP_ADD(first,1),BOOST_PP_ADD(last,2),\
                          NUM_SIG_DECLARE_CONNECT,BOOST_PP_EMPTY)

 I don't claim to understand everything that's going on here (even
 remotely), but GCC 3.2 and 3.3 are very happy with the usage (in a
 header file)

NUM_SIG_CONNECTION_FUNCTIONS_FOR_MEMBERS(0, MAX_SIGNAL_ARGS);

 while 3.4 complains about that semicolon. What I'm asking is A) does
 anyone know if 3.4 has a particular -Wno-extra-semicolon, or
 equivalent, to turn off that warning; or B) what is the proper
 preprocessor metaprogramming technique to silence the warning.

 Thanks!!

----------------------------------------------------------------------
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-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net