Mail Archives: djgpp/1997/09/02/00:23:28
Mike4148 wrote:
>
> Hey, I'm a veteran. In BTC++ 3.0 the little array index number you
> initialize an array with was the last element number. I'm not getting the
> book, by the way :).
Then this compiler was not a standard C++ compiler. An array of size n
is indexed 0..(n-1). This is an immutable rule of the C language.
Real mode programs have less safeguards against illegal memory accesses
than protected mode programs, so it's quite possible that you could
access invalid array elements without causing an immediate crash. This
does not mean that it didn't screw up something else in the program; in
fact, the chances of this are quite high. Ironically, variable
alignment in 32-bit programs might occasionally make it safer to access
that 'nth' array element, because of the "dead" space at the end of the
block of memory. :)
--
---------------------------------------------------------------------
| John M. Aldrich | "Courage is the complement of fear. |
| aka Fighteer I | A man who is fearless cannot be |
| mailto:fighteer AT cs DOT com | courageous. (He is also a fool.)" |
| http://www.cs.com/fighteer | - Lazarus Long |
---------------------------------------------------------------------
- Raw text -