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!news1.google.com!news3.google.com!news.glorb.com!newsfeed2.telusplanet.net!newsfeed.telus.net!edtnps82.POSTED!53ab2750!not-for-mail From: Gordon Sande Newsgroups: comp.lang.ada,comp.lang.fortran,comp.lang.pl1 Message-ID: <2006052712085316807-gsande@worldnetattnet> 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> <1hfv5wb.1x4ab1tbdzk7eN%nospam@see.signature> <2006052509454116807-gsande@worldnetattnet> <4475DA0F.5030603@comcast.net> <2006052514574816807-gsande@worldnetattnet> <2OEdg.167448$eR6.128849@bgtnsc04-news.ops.worldnet.att.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: Checking for Undefined User-Agent: Unison/1.7.5 Date: Sat, 27 May 2006 15:08:53 GMT NNTP-Posting-Host: 24.89.210.20 X-Trace: edtnps82 1148742533 24.89.210.20 (Sat, 27 May 2006 09:08:53 MDT) NNTP-Posting-Date: Sat, 27 May 2006 09:08:53 MDT Xref: g2news2.google.com comp.lang.ada:4546 comp.lang.fortran:10358 comp.lang.pl1:1772 Date: 2006-05-27T15:08:53+00:00 List-Id: On 2006-05-27 11:29:29 -0300, "robin" said: > "Dick Hendrickson" wrote in message > news:2OEdg.167448$eR6.128849@bgtnsc04-news.ops.worldnet.att.net... >> This isn't really relevant to the post I'm replying to, but >> my newsreader has lost the one I wanted to reply to. Sorry. >> >> There's a deep problem in Fortran with detecting usage of >> undefined variables. The problem is that an error condition >> during input causes all input items to become undefined. >> Given a statement like >> read (unit, err = 100) j, x(j), j, x(j) >> What's supposed to happen? If the error occurs after the >> second read of "j", how does the processor go back and >> flag the first instance of x([old value of]j) as undefined >> when "j" no longer has the old value? Sure, in this >> example it's easy enough for the processor to keep a little >> list of variables. But, what if the input list is inside >> an do-loop that goes from 1 to some huge number. There's >> no practical way to keep the list of potentially undefined >> values. The practical man is likly to say that the problem here is the GENERATION of the undefined values. That is when the execution should be flagged as erroneous. Letting them be and tracking them is awkward but seems to be an invented problem that is more the unintended result of the particular wording. Assign the problem to a thesis student and let the real world gt on with doing real things. If undefined variable checking were to be part of the standard then this is an issue that might deserve better wording but I would not expect it make any realistic checklist. Since the program starts will all variables undefined the testing for their use is a practical thing to want. Otherwise all that is being asked for is to initialize everything, which seems to ignore the real issue of real programming errors. If one wants to be fussy one might say that a divide by zero is just generating an undefined it is no problem unles the result is used. That is exactly what NANs do so it has considerable utility. > By keeping a shadow array of bits, any undefined > value can be flagged. > >> You can't spray the array with "undefined" flags >> before the input, since not all values are necessarily >> changed. You can't make a shadow copy of the array and >> look for changed elements, because input doesn't have to >> change the value in an element and making a shadow copy >> of a million word array is impractical. > > It isn't impractical, because only 3% of additional storage > is required (see above). > >> I think there are cases in Fortran where usage of what >> the language calls undefined variables is not detectable >> in any practical sense of the word. > > See above.