quotes inside #if 0

Doug Gwyn gwyn at smoke.BRL.MIL
Fri Sep 8 20:42:50 AEST 1989


In article <32905 at ism780c.isc.com> marv at ism780.UUCP (Marvin Rubenstein) writes:
>In article <10969 at smoke.BRL.MIL> gwyn at brl.arpa (Doug Gwyn) writes:
>>A lot of people say "the Standard broke [whatever]".  The proposed
>>Standard breaks nothing.  Standard-conforming C implementations may
>>well not produce the same results as others have been producing, but
>>there has always been that degree of variation among C compilers.
>Here is an example of *well defined* code that produces different results:

Different from K&R I, perhaps, but not necessarily from widespread practice.
Even AT&T's own PCC didn't follow all the specifications in K&R I.  Many
times it was necessary for X3J11 to consider all the existing implementations
and weigh them against the "base document".  In the case of unsigned-
preserving vs. value-preserving default promotion rules, both methods were
in use, and the committee opted for the one that would cause the fewest
unpleasant surprises for the programmer (i.e. value-preserving).

>       "a string of the form "\078" is valid, but now has a different
>       meaning"

Yes, it now means what the programmer would reasonably expect, since
8 is no longer considered an "octal digit".  There were implementations
that did this right instead of the way Ritchie originally implemented it.

>       "A string of the form "\a" or "\x" now has a different meaning"

However, nobody is likely to have written "a" as "\a" in existing code.

>The standard has clarified the semantics of many cases where different
>compilers produced different results.  But it also changed the semantics of
>several cases where there was no ambiguity in the base document (K&R).  The
>standard does indeed 'break' things.

As I tried to make clear, these things were already "broken" one way or
another, if no other way than by having widespread variation in existing
implementations.

>The only way I can read Doug's assertion (such that it is true) is to say:
>since there was no standard for C before THE standard, no programs had
>a well defined behavior so nothing got broken.

That is not far from the truth.  PCC was widely regarded as the criterion
for "what C was", even though it differed from the spec in K&R in several
ways.  Other people would have argued that K&R I was "what C was", even
though several important widely-accepted useful extensions occurred after
the book was published.  And so on.

Anyway, you DROPPED THE CONTEXT to which my comment was a response.
The complaint that existing nonportable code that exploited a specific
interpretation of a "grey area" of the language spec was "broken" by
the proposed Standard was unfounded.  The grey area was clarified in
the best way we could, weighing many factors in the process, in such a
way that that particular exploitation has been shown up for the risky
affair that it always was.



More information about the Comp.lang.c mailing list