Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!ames!pasteur!ucbvax!hplabs!sdcrdcf!ism780c!haddock!karl From: karl@haddock.ISC.COM (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: trigraphs in X3J11 Message-ID: <4189@haddock.ISC.COM> Date: 24 May 88 22:28:14 GMT References: <5215@ico.ISC.COM> <10949@apple.Apple.Com> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Boston Lines: 31 In article <10949@apple.Apple.Com> lenoil@apple.UUCP (Robert Lenoil) writes: >Instead of introducing [trigraphs], why not simply extend the backslash >escape mechanism to be valid outside of strings? That's an easy one: backslash is one of the characters that may not exist! >This would allow the use of #defines >#define ??< \173 /* open brace */ >#define ??> \175 /* close brace */ Not unless you extend the preprocessor's notion of what constitutes a valid macro name. Note also that the magic constants \173 and \175 are unportable. In article <10941@steinmetz.ge.com> davidsen@steinmetz.ge.com (William E. Davidsen Jr) writes: >I scanned my local source directory and found three programs of 102 which >would break. ... I did NOT scan the directory of programs which do device >control, since I have made that point and every one would break and have to >be handcoded with escape sequences, etc, do get by this. Are you sure you have that many programs that would break? Note that `??' alone is not a problem; it becomes a trigraph only when followed by one of the nine characters "=(/)'-". (Unlike backslash, which is reserved even if the following character is unrecognized.) Assuming trigraphs stay in, the fix is simple: filter your code through sed -e "s;??\\([-=(/)']\\);?\\\\?\\1;g" as part of the ANSIfication process. (Better yet, do it now before you run into a compiler with trigraphs. It won't hurt, unless your current compiler complains about the unrecognized escape "\?".) Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint