[net.arch] Subscript out-of-bounds detection

joe@petsd.UUCP (Joe Orost) (09/30/85)

In article <568@unisoft.UUCP> phil@unisoft.UUCP (Phil Ronzone) writes:
>Shucks - but I still CAN'T see how much the poor pilot in an F16 with an
>Ada programmed fire-control computer is going to be as a Mig-27 bears down
>on him, and right when he hears the lock-on buzz to fire his own missile --
>
>     Ada runtime error 498: subscript i value 23 out of range for array x (20)
>
>I mean,
>   
>     Bus error - core dumped
>
>reads quicker and thus gives the pilot a faster ``oh shit'' response time
>to take evasive action .... :-) :-)

Ada isn't as verbose as you think.  The Ada compiler I once used gave the
following run-time message:

	raise: no handler

and NO CORE DUMP!  Try to find the bug there?

However, there are some flaws in your "Bus error" logic.  An out-of-bounds
array subscript may not make the C or Fortran program die.  It just might
overwrite some random variable!  Say it overwrote the current altitude and
caused the plane to nose dive!  Wouldn't it be better for the error to just 
abort the subroutine it was in, and allow the rest of the program to 
recover, like Ada provides?  Remember, it was the DoD that came up with the
guidelines for the design of Ada in the first place.

				regards,
				joe

--

 ........        .........	Full-Name:  Joseph M. Orost
 .       .       .		UUCP:       ihnp4!vax135!petsd!joe
 . ......   ...  ........	ARPA:	    vax135!petsd!joe@BERKELEY
 .               .		Phone:      (201) 758-7284
 .               .........	Location:   40 19'49" N / 74 04'37" W
				US Mail:    MS 313; Perkin-Elmer; 106 Apple St
					    Tinton Falls, NJ 07724