g++/cpp problem with macros expanding to /##/
Alexandre Oliva
oliva@dcc.unicamp.br
Sat Oct 3 08:10:00 GMT 1998
Craig Bridge <Craig.Bridge@seagatesoftware.com> writes:
> The "Just don't do it" answer doesn't cut it.
Sorry, it's the only portable solution. You shouldn't rely on a
feature that the Standard explicitly forbids.
> Is there a simple way to get two preprocessor passes?
g++ -E - < file.cc | g++ -E - > file.ii && g++ file.ii
> I haven't figured out how to get g++ to take input from
> stdin.
The pre-processor will read from stdin; the C++ compiler won't
> Most of the comercially available compilers, Borland, Intergraph,
> Microsoft, Sun, Watcom, etc. support this feature.
> Many of their header files even use this trick to allow them to
> share include files between systems with various capabilities.
You should take a look at SGI STL (distributed with egcs); that's an
example of a portable way to enable or disable various capabilities
depending on the compiler's abilities.
--
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil
More information about the Gcc-bugs
mailing list