This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: PATCH: BPs & cleanups for ARRAY_SIZE


On Aug 23, 2000, Geoff Keating <geoffk@cygnus.com> wrote:

> Alexandre Oliva <aoliva@redhat.com> writes:

>> On Aug 23, 2000, Greg McGary <greg@mcgary.org> wrote:
>> 
>> >          -- An  array  subscript is out of range, even if an object
>> >             is apparently accessible with the given  subscript  (as
>> >             in  the lvalue expression a[1][7] given the declaration
>> >             int a[4][5]) (6.5.6).
>> 
>> Ok, this applies to array subscripts, but does it apply to pointers
>> derived from the arrays too?  In particular, does it apply to char*s?

> Yes.  (Section 6.5.6 is actually about the additive operators, not about []).

But char* is supposed to be usable to iterate over raw memory.  It
should be well-defined behavior.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]