Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cmcl2!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: Another silly question Message-ID: <10299@smoke.BRL.MIL> Date: 21 May 89 02:46:54 GMT References: <17812@cup.portal.com> <607@kl-cs.UUCP> <749@mccc.UUCP> <1657@auspex.auspex.com> <13234@haddock.ima.isc.com> Reply-To: gwyn@brl.arpa (Doug Gwyn) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 25 In article <13234@haddock.ima.isc.com> karl@haddock.ima.isc.com (Karl Heuer) writes: >I thought it strange that X3J11 outlawed "x+ =1" ("+=" is now a single >token), but permitted "i[a]" (on the grounds that they "saw no reason >to forbid it"). It was never clear why the old C language reference manual said "the two parts of a compound assignment operator are separate tokens" when the formal grammar showed them as indivisible units. That may have simply been a description of the (somewhat sloppy) way the implementation of the PCC lexer happened to work. Another possibility is that it was desired to guarantee that such an operator could be constructed via preprocessing. X3J11 allows the latter anyway. It seems for more likely that "x+ =1" is a typo than that it is intended. "i[a]" on the other hand has actually been intentionally used by some programmers, although most of us certainly don't recommend it. >... outlawing "i[a]" would have been a small step >towards making arrays higher-class citizens than they are. I don't think you can ever make the existing C arrays first-class objects without invalidating large amounts of existing correct code. There are efforts underway to find a suitable language extension that solves this problem (for the new class of objects provided by the extension).