[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: 6502 illegal opcodes questions
Paul Schlyter wrote:
> It's easy to exceed the bounds of an array by accident and overwrite other
> data structures in the program with garbage. Apparently it's no more difficult
> in Ada than in FORTRAN or C ......
Ada provides bounds checking on array indices, and in addition provides
an "in" construct which can be used to iterate over an array without
specifying the number of iterations in the loop construct as you
typically would in C
To fall over the edge of an array in Ada, you'd need to do this quite
deliberately. It would require determining the address of either the
first or last element, and deliberately modifying the pointer to
overstep the array bounds.
In short, this never happens "by accident" in Ada, it must happen by
design. This pretty much means that in practice, it never happens.
Matt