Path: utzoo!mnetor!uunet!husc6!mailrus!ames!oliveb!sun!gorodish!guy
From: guy@gorodish.Sun.COM (Guy Harris)
Newsgroups: comp.arch
Subject: Re: Is the Intel memory model safe from NO-ONE ?!?
Message-ID: <52426@sun.uucp>
Date: 8 May 88 22:48:02 GMT
References: <1806@obiwan.mips.COM> <2904@omepd> <353@cf-cm.UUCP> <2430@louie.udel.EDU>
Sender: news@sun.uucp
Lines: 18

>    Fact is, if i have an array of something, i want it to be in its own 
> legal region, and i want it to be bounds-checked when i mess with it. 
> Before any one goes off the handle about cost, remember the cost
> of all those programs that duplicate this stuff in C code. 

Except that programs that duplicate that stuff in C (or whatever) code tend to
do something useful when if the subscript is out of range.  For a somewhat
trivial example, consider a program that reads a large array of numbers from a
file, and then prompts the user for an array index and prints out the element
of the array selected by that index.  Even in a language and implementation
that does array-bounds checking, a program that just reads the index and uses
it without first checking whether it's in range is wrong.  Telling the user
"try again, the valid indices are M through N" is far better than giving them a
"subscript range exceeded" error and a stack trace.

Having the language and its implementation do this checking may be helpful in
detecting bugs; however, in many cases you still have to put in the check
yourself anyway if you want a reasonable program.