This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
RE: Inconsistent hierarchy
- To: 'Jerry Miller' <gmiller at cs dot sunysb dot edu>, help-gcc at gnu dot org
- Subject: RE: Inconsistent hierarchy
- From: David Korn <dkorn at pixelpower dot com>
- Date: Fri, 23 Feb 2001 17:47:00 -0000
>-----Original Message-----
>From: Jerry Miller [mailto:gmiller@cs.sunysb.edu]
>Sent: 22 February 2001 03:31
[Rather an old one, but better late than never]
>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.
Well, there would be a slight problem with that: if you stop parsing
the moment you hit a #if 0, how do you know when to start parsing again?
At the very least you'd have to watch out for the #endif; and of course
you've got to watch out for nested #if-#endif pairs, so that you don't
start parsing again too easily, and it gets complex very quickly.
I believe the C language standard actually specifies that everything
in the source file must be valid C preprocessing tokens, even if it is
enclosed in a #if 0. It isn't to do with 'hierarchies' (I assume you
mean something like operator precedence here), and if it doesn't happen
on a newer version of the compiler I assume that means that somebody got
annoyed and did something about it.
I ran across this problem for myself quite a while ago, since I used
to like doing stuff like...
#if 0
... code ...
aha this code isn't finished yet so I shall use if 0 to stop it compiling
#endif
and the preprocessor complained about my unterminated character constant,
having taken the ' in "isn't" for the opening apostrophe of a character
constant.
This isn't really a solution to your problem, because there isn't one
except to watch out for and correct those apostrophes as you encounter
them; sorry.
DaveK
--
we are not seats or eyeballs or end users or consumers.
we are human beings - and our reach exceeds your grasp.
deal with it. - cluetrain.org
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.
www.mimesweeper.com
**********************************************************************