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,703c4f68db81387d X-Google-Thread: 109fba,703c4f68db81387d X-Google-Thread: 115aec,703c4f68db81387d X-Google-Thread: f43e6,703c4f68db81387d X-Google-Attributes: gid103376,gid109fba,gid115aec,gidf43e6,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!news.glorb.com!wn14feed!worldnet.att.net!12.120.4.37!attcg2!attcg1!ip.att.net!news.binc.net!kilgallen From: Kilgallen@SpamCop.net (Larry Kilgallen) Newsgroups: comp.lang.ada,comp.lang.c++,comp.realtime,comp.software-eng Subject: Re: Teaching new tricks to an old dog (C++ -->Ada) Date: 9 Mar 2005 11:03:14 -0600 Organization: LJK Software Message-ID: References: <4229bad9$0$1019$afc38c87@news.optusnet.com.au> <1110377260.350158.58730@z14g2000cwz.googlegroups.com> NNTP-Posting-Host: eisner.encompasserve.org X-Trace: grandcanyon.binc.net 1110387742 3844 192.135.80.34 (9 Mar 2005 17:02:22 GMT) X-Complaints-To: abuse@binc.net NNTP-Posting-Date: Wed, 9 Mar 2005 17:02:22 +0000 (UTC) Xref: g2news1.google.com comp.lang.ada:8953 comp.lang.c++:44806 comp.realtime:1143 comp.software-eng:4701 Date: 2005-03-09T11:03:14-06:00 List-Id: In article <1110377260.350158.58730@z14g2000cwz.googlegroups.com>, "Hans Malherbe" writes: > Somewhere in this thread Loduvic writes: > > * in Ada, loop variables (a) are constants and (b) do not exist outside > of the loop > > This is safer, but limiting. > In C++ may want to declare the variable outside the loop, > break out early and use the loop variable. Let me guess: You can't > break out early in Ada, right? You can, but if I want to export the loop variable I use something like: for each_fluvark in fluvark_array'range loop ... if some_value = 42 then last_value_of_fluvark_index := fluvark_index; exit; end if; ... end loop; making quite explicit the difference between the changing value of the index and the final value at which we exited the loop. > A few other questions: > > Do you have nested functions like Pascal have? Even Bliss has nested functions. What Ada has that Pascal has in addition to nested functions is uplevel addressing, allowing an inner function to access data declared in outer scopes.