PATCH: BPs & cleanups for ARRAY_SIZE

Alexandre Oliva aoliva@redhat.com
Wed Aug 23 14:02:00 GMT 2000


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



More information about the Gcc-patches mailing list