array[-1] -- permitted?
Every system needs one
terry at wsccs.UUCP
Wed Sep 28 14:27:41 AEST 1988
In article <1237 at imagine.PAWL.RPI.EDU>, kyriazis at 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 |
More information about the Comp.lang.c
mailing list