Gen Zhang writes:
On Thu, 2005-06-30 at 08:30 -0400, David Abrahams wrote:
Dave Steffen
writes: I claim that our macros and use thereof is A) correct and B) safe. It just so happens that these macro constructs occasionally expand to something that has an extra semicolon, which triggers a warning in GCC 3.4 that we haven't seen before.
The warning will be an error on other compilers. The semicolons aren't just "bad style;" they're illegal.
I believe The Book specifically allows an optional semicolon at the end of a function declaration in the global scope. They are illegal in a class. And necessary at the end of a class/struct definition. I have a friend who runs into this problem a lot. :D
Yeah, this is one question - is it legal? If so, the next question is : can we find anything to stick on the end of these macros to make it legal? For example, I think a variable declaration might be OK there. So maybe we do something like having the macro expand into (this is nasty, but it might work) int Foo() { ... } int i_am_a_variable_at_line_970_of_file_X in which case a trailing semicolon would be perfectly at home. Of course, this is rather nasty for all kinds of reasons. Is there a way to make a "null declaration"? :-) ---------------------------------------------------------------------- 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@numerica.us ... 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.