Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!ncar!ico!ism780c!news From: news@ism780c.isc.com (News system) Newsgroups: comp.lang.c Subject: Re: quotes inside #if 0 Keywords: ANSI, comments Message-ID: <32905@ism780c.isc.com> Date: 7 Sep 89 21:59:45 GMT References: <2014@munnari.oz.au> <10935@smoke.BRL.MIL> <3626@yunexus.UUCP> <10969@smoke.BRL.MIL> Reply-To: marv@ism780.UUCP (Marvin Rubenstein) Organization: Interactive Systems Corp., Santa Monica CA Lines: 43 In article <10969@smoke.BRL.MIL> gwyn@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: Main() { unsigned char c=1; if (c-2>0) else The 'usual conversion rules' in K&R requires that the expression c-2 is unsigned and therfore the executes. The ANSI 'usual conversion rules' requires that the expression c-2 be signed and therefore the executes. This change and other similar ones are called 'quiet changes' These are direct quotes from the Rationale: "a string of the form "\078" is valid, but now has a different meaning" "A string of the form "\a" or "\x" now has a different meaning" "A program that depends upon unsigned preserving arithmetic conversions will behave differently, probably without complaint. This is considered the most serious semantic change made by the Committee to a wide spread current practice". 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. 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. Marv Rubinstein PS: I have heard that Unix release 5.4 uses two compilers. One to compile Unix and one (ANSII) for new programs. Does any one know if this is true?