Path: utzoo!attcan!uunet!husc6!bloom-beacon!tut.cis.ohio-state.edu!mailrus!wasatch!utah-gr!uplherc!sp7040!obie!wsccs!terry From: terry@wsccs.UUCP (Every system needs one) Newsgroups: comp.lang.c Subject: Re: array[-1] -- permitted? Message-ID: <680@wsccs.UUCP> Date: 28 Sep 88 04:27:41 GMT References: <867@osupyr.mast.ohio-state.edu> <3200@geac.UUCP> <1430@ficc.uu.net> <1237@imagine.PAWL.RPI.EDU> Lines: 36 In article <1237@imagine.PAWL.RPI.EDU>, kyriazis@rpics (George Kyriazis) writes: > Excuse for the question, but that is the first time I am looking at that > subject and I don't see any reason why x[-a] can't be permitted, mainly > for two basic reasons: > (a) x[a] == *(x+a) therefore x[-1] == *(x-1), which looks > perfectly ok to me. > > (b) yacc uses array[-1]. If it is considered invalid, that will mean > that yacc has to be rewriten for the new standard? > > Am I missing something? Yes. The source for who contains the following type of thing: char *str = "hello world"+6; where printf( "'%c'", str[ -6]); gives 'h'. This is is used in the "who am i" command. It works on most C compilers (with 1 exception still in developement). The exception is due to the method of compilation requiring a "fake node" to make it work. DMR is quoted as saying it should work by the compiler writer, even in ANSI C. | Terry Lambert UUCP: ...{ decvax, ihnp4 } ...utah-cs!century!terry | | @ Century Software OR: ...utah-cs!uplherc!sp7040!obie!wsccs!terry | | SLC, Utah | | These opinions are not my companies, but if you find them | | useful, send a $20.00 donation to Brisbane Australia... | | 'I have an eight user poetic liscence' - me |