At 06:23 PM 3/9/2003, David Abrahams wrote: >is ";" legal where a declaration is expected? > >class X >{ > ; // legal? >}; > >Comeau says it isn't: > >MODE:strict errors C++ > >"ComeauTest.c", line 3: 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 > ; // legal? > ^
GCC 3.2 says yes, EDG 3.1 says no: $ cat foo.cpp void foo() { ; } struct x { ; }; ; $ gcc -ansi -pedantic -c foo.cpp $ edgcc --strict foo.cpp "foo.cpp", line 6: error: extra ";" ignored ; ^ "foo.cpp", line 9: error: extra ";" ignored ; ^ I suspect EDG is right as usual, but it isn't going to be portable no matter the standard says. The only way I see to make this work is for the macros to include the semicolons, so that the debug versions can expand to nothing at all. Ugly, but I've committed far worse crimes with CPP. "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost