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-Attributes: gid103376,gid1094ba,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!sn-xt-sjc-15!sn-xt-sjc-06!sn-xt-sjc-01!sn-post-sjc-01!supernews.com!news.supernews.com!nospam From: nospam@see.signature (Richard Maine) Newsgroups: comp.lang.ada,comp.lang.fortran Subject: Re: Bounds Check Overhead Date: Fri, 26 May 2006 12:16:04 -0700 Organization: Posted via Supernews, http://www.supernews.com Message-ID: <1hfy1qn.gqhqkc1qq8ahaN%nospam@see.signature> 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> <4475DA61.3080001@comcast.net> <44762F55.4050106@cits1.stanford.edu> <87hd3d1472.fsf@ludovic-brenta.org> <3cBdg.6255$oa3.2407@trnddc08> <1148655583.421963.226740@j55g2000cwa.googlegroups.com> <1148668910.867823.99110@j73g2000cwa.googlegroups.com> User-Agent: MacSOUP/2.7 (Mac OS X version 10.4.4) X-Complaints-To: abuse@supernews.com Xref: g2news2.google.com comp.lang.ada:4509 comp.lang.fortran:10308 Date: 2006-05-26T12:16:04-07:00 List-Id: Dan Nagle wrote: > Hello, > > gary.l.scott@lmco.com wrote: > > I was just thinking that if the loop counter was in fact declared to be > > volatile, that the declaration of such should cause the compiler to > > diagnose it as an incompatible loop index variable (i.e. F2k8+). > > In 04-007, at 167[22:23], the may not be redefined. > > The volatile attribute, at 85[5:6], specifies that the variable may > become undefined or redefined by a means outside the program. > > I suppose it's a theorem left for the reader to prove that > a do-index should not be volatile, or at worst, if it is, > the volatile part is ineffective. > > I'll ask on the J3 list to see whether there's sentiment > for addressing this directly, or if I missed something > in my quick perusal of the standard. I think you are missing half of the purpose of volatile. You've got the half about a volatile variable possibly getting modified elsewhere, but you forgot the part about the volatile variable possibly being referenced elsewhere. They are the opposite sides of the same coin, depending on whether you are sedning data to or getting data from the external source. The volatile attribute doesn't distinguish. I see nothing inherently wrong in making a loop variable volatile so that some external source can reference it. It is likely to kill the performance of the loop, but presumably the user would realize that. Volatile is a performance killer in general, but this is "known". An alternate, verbose spelling of volatile might be "do everything exactly as I said, one step at a time, no matter how stupid it might look; trust me." -- Richard Maine | Good judgement comes from experience; email: last name at domain . net | experience comes from bad judgement. domain: summertriangle | -- Mark Twain