array[-1] -- permitted?

George Kyriazis kyriazis at rpics
Thu Sep 22 16:42:13 AEST 1988


In article <2583 at ingr.UUCP> jones at ingr.UUCP (Mark Jones) writes:
>In article <1988Sep19.164701.11136 at ateng.uucp>, chip at ateng.uucp (Chip Salzenberg) writes:
>> According to news at ism780c.isc.com:
>> >But consider what might have happened had dpANS mandated that the compution
>> >of a pointer to x[-1] be a valid operation.
>> 
>> Okay, let's imagine:  X3J11 says that x[-1] must be valid.
>> 	       then:  int must be 32 bits.
>
>Excuse my ignorance, but why must an int be 32 bits for the above to work?
>
>> 	       then:  address space must be linear.
>
>Does X3J11 say that the contents of x[-1] must be valid?
>
>Mark Jones


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?



  George Kyriazis
  kyriazis at turing.cs.rpi.edu
------------------------------



More information about the Comp.lang.c mailing list