Inconsistent hierarchy

Jerry Miller gmiller@cs.sunysb.edu
Wed Feb 21 19:43:00 GMT 2001


I'm developing code that will run under both
UNIX (i.e., Solaris) and Windows NT (using
Interix/Posix on top of NT).  In both cases, I
am using gcc for compilation.

The Solaris version is sparc-sun-solaris2.6-gcc;
the version supplied with Interix has the following
directory entry:
05/15/98  11:04p               137,216 gcc

For the purpose of self-documentation, I have left
my original PL/I code intact and written the C code
around it.  Using /**/ to comment out code is not
practical, because comments cannot be nested;
therefore, I have used
#ifdef ABCDEFGHIJKLMNOPQRSTUVWXYZ
#endif
to isolate the PL/I code.  This has worked without
a problem under NT; however, when I strip out
carriage returns and attempt to compile the otherwise
exact same code on the Sun, I get a complaint about
a mismatched quote.

It turns out that the string '/|\' is valid under PL/I, but
it escapes the second single-quote under C.  However,
the compiler seems to have no business whatsoever
parsing something whose #ifdef condition has not been
met.  It appears that the respective hierarchies of the
quote symbol and the #ifdef/#endif pair are reversed
between these two versions, and according to my own
perception, it is the PC version whose behavior seems
more intuitive.




More information about the Gcc-help mailing list