
"Andy Little" <andy@servocomm.freeserve.co.uk> writes:
"Dave Steffen" <dgsteffen@numerica.us> wrote
Arkadiy Vertleyb writes:
Hi all,
Not having extra semicolons is one of the strongest arguments against incuding a trailing semicolon into a statement-generating macro. Can anybody explain why having an extra semicolon is considered a potential problem by some compilers? Isn't null as good as any other number? Shouldn't an empty statement be considered as good as any other statement?
Ths issue is IIRC and AFAIK macros that are used outside of any statement blocks, i.e. the thing David Abrahams suggested that spawned this whole thread. Something like a macro that declares or defines a function:
#define MAKEFOO inline void foo () { ... }
and then simply used as:
(... other inline functions, for example ...) MAKEFOO;
FWIW This compiles fine in VC7.1 . AFAIK there is no C++ rule banning an empty statement in any scope( including namespace scope) where a statement is otherwise allowed.
But that's just it: statements aren't allowed at namespace scope. Comeau C/C++ 4.3.3 (Aug 6 2003 15:13:37) for ONLINE_EVALUATION_BETA1 Copyright 1988-2003 Comeau Computing. All rights reserved. MODE:strict errors C++ "ComeauTest.c", line 2: error: extra ";" ignored, In C: A function definition does not end with a semicolon In C++: A function definition, extern "C" or namespace, does not end with a semicolon MAKEFOO; ^ 1 error detected in the compilation of "ComeauTest.c". In strict mode, with -tused, Compile failed -- Dave Abrahams Boost Consulting www.boost-consulting.com