From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c4cb2c432feebd9d X-Google-Thread: 1094ba,c4cb2c432feebd9d X-Google-Thread: 101deb,15c6ed4b761968e6 X-Google-Attributes: gid103376,gid1094ba,gid101deb,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Fri, 26 May 2006 15:18:19 -0500 Date: Fri, 26 May 2006 13:18:50 -0700 From: glen herrmannsfeldt User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada,comp.lang.fortran,comp.lang.pl1 Subject: Re: Ada vs Fortran for scientific applications References: <0ugu4e.4i7.ln@hunter.axlog.fr> <%P_cg.155733$eR6.26337@bgtnsc04-news.ops.worldnet.att.net> <6H9dg.10258$S7.9150@news-server.bigpond.net.au> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 24.18.174.4 X-Trace: sv3-vdBGNr5k8KX0vuFtHcOw51NVlwv5vB+9UndkafjFIo8HyzZMyGhXmpbhjHZzl70tTMdQ9T7en3cTeFw!dOLA2Iv4imAP1v7CRMkpiCVZeQjTdBUw/fGTbt01zJ3O/E+yhltZba2hSQmcE1VA0DCQ X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.32 Xref: g2news2.google.com comp.lang.ada:4516 comp.lang.fortran:10315 comp.lang.pl1:1744 Date: 2006-05-26T13:18:50-07:00 List-Id: Dick Hendrickson wrote: > robin wrote: (snip) >> But, as I pointed out, being part of the language means >> that subscript checking can be applied to an entire program, >> a procedure, a statement, a block of statements, etc. > Not really, if it's "part of the language", then the > language defines where, when, and how it can be applied. Yes, but it depends on what you mean by "can"... > There's no particular reason why a language definition > couldn't specify a global application, or a block-by-block > application of bounds checking, or couldn't limit it only to > statements that have a prime number of keystrokes. It's a > design choice between need and efficiency. Having it part of the language allows the language to specify it at the block or statement level, but does not require that ability. Not having it part of the language doesn't preclude it, but makes it difficult. How would you specify it at the statement level as a compiler command line option? You could specify the statement number, but that would work only for numbered statements. Also, most Fortran compilers can compile more than one routine with a single invocation, and the statement number could be duplicated in different routines. It could be specified as a line number, but that would make editing inconvenient. Also, at least for Java and PL/I, bounds checking is part of the exception model. To get away from the PL/I discussion, consider the Java code: static public void main(String args[]) { int x[]=new int[10]; /* allocate a 10 element array */ try{ /* index the array with the first command line argument */ x[Integer.parseInt(args[0])]=3; } catch(ArrayIndexOutOfBoundsException e) { System.out.println("Oops: "+e); } } } This program indexes an array with its first command line argument, so can easily be tested. The program can then go do whatever is needed after detecting the bad subscript. In this case the try{} block is only one statement, but it can be much larger. One difference between the Java and PL/I exception model is that in many cases PL/I allows one to correct and resume the statement in error, where Java does not allow that. -- glen