cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1997/09/02/00:23:28

From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Whatever
Date: Mon, 01 Sep 1997 23:36:06 +0000
Organization: Two pounds of chaos and a pinch of salt
Lines: 25
Message-ID: <340B5166.52B1@cs.com>
References: <19970825183100 DOT OAA00811 AT ladder02 DOT news DOT aol DOT com>
Reply-To: fighteer AT cs DOT com
NNTP-Posting-Host: ppp109.cs.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019