ANSI proposal for preprocessor strings

Henry Spencer henry at utzoo.UUCP
Sun Mar 10 10:25:37 AEST 1985


> >The ANSI C standard wants to support TOKENIZED preprocessing.
> >The character-string based kludges possible with the Reiser CPP
> >do not fit into this concept.
> 
> I don't see what the problem is.  You have to deal with strings
> specially anyway to handle \n, et. al., right?  So, at the same time,
> divide it up into tokens and see if any match the macro parameters.
> Note that you only have to do this if the string is in a parametered
> macro definition, so the overhead shouldn't be too bad.  

The trouble is that these two operations (escape processing and macro
handling) often take place at quite different times.  I know of at
least one compiler (admittedly, an obscure one) which doesn't really
deal with string escapes until code-generation time.  Others deal with
them right away, as the string is being scanned, well before anyone
knows that it's part of a macro.

Nobody's claiming that the Reiser things are impossible, just that they
are awkward to do, unclean in concept, undocumented, and not widely
accepted in non-Unix implementations.

> Anyway, its not clear that the standard should not include something
> only because it might be hard to implement in a certain manner.

<begin cynical, not-entirely-serious tone>
Why not?  That's the way C has developed so far.  Why change a winning way?
<end tone>
To my mind, the "undocumented", "unclean in concept", and "not widely
accepted in non-Unix implementations" parts are rather more significant.
-- 
				Henry Spencer @ U of Toronto Zoology
				{allegra,ihnp4,linus,decvax}!utzoo!henry



More information about the Comp.lang.c mailing list