This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Python: should gdb.Value array indexing check bounds?


On Tue, Sep 20, 2011 at 9:04 AM,  <Paul_Koning@dell.com> wrote:
> Currently, if a gdb.Value object corresponds to an array, array indexing is done C-style: no bounds checking, just pointer arithmetic.? That's somewhat unnatural to Python.? Should it do a range check instead, and raise IndexError for out of range index values?
>
> That wouldn't affect indexing of pointers, since those don't have a range so the only possible approach is the C one.

I'd think no because of things like:
http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Zero-Length.html
(which is possible with non-zero length arrays also).


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