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!news3.google.com!news.glorb.com!fr.ip.ndsoftware.net!ciril.fr!oleane.net!oleane!not-for-mail From: =?UTF-8?B?RmFsayBUYW5uaMOkdXNlcg==?= Newsgroups: comp.lang.ada,comp.lang.c++,comp.realtime,comp.software-eng Subject: Re: Teaching new tricks to an old dog (C++ -->Ada) Date: Thu, 10 Mar 2005 11:11:45 +0100 Organization: Canon Research Centre France Message-ID: References: <4229bad9$0$1019$afc38c87@news.optusnet.com.au> <1110032222.447846.167060@g14g2000cwa.googlegroups.com> <871xau9nlh.fsf@insalien.org> <3SjWd.103128$Vf.3969241@news000.worldonline.dk> <87r7iu85lf.fsf@insalien.org> <1110052142.832650@athnrd02> <1110284070.410136.205090@o13g2000cwo.googlegroups.com> <395uqaF5rhu2mU1@individual.net> <1110377260.350158.58730@z14g2000cwz.googlegroups.com> <1110383768.773379.61780@o13g2000cwo.googlegroups.com> <399tkeF5utki4U1@individual.net> NNTP-Posting-Host: centre.crf.canon.fr Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: s1.news.oleane.net 1110449490 7155 194.2.158.33 (10 Mar 2005 10:11:30 GMT) X-Complaints-To: abuse@oleane.net NNTP-Posting-Date: Thu, 10 Mar 2005 10:11:30 +0000 (UTC) User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041217 X-Accept-Language: de, fr, pl, en, en-us In-Reply-To: <399tkeF5utki4U1@individual.net> Xref: g2news1.google.com comp.lang.ada:9020 comp.lang.c++:44931 comp.realtime:1190 comp.software-eng:4753 Date: 2005-03-10T11:11:45+01:00 List-Id: Wes Groleau wrote: > jimmaureenrogers@worldnet.att.net wrote: >> The simple loop will always be an infinite loop unless >> you break out early. The Ada reserved word used to >> break out of a loop is "exit". In Ada "exit" does not >> exit the program, only the enlcosing loop. > Or (for nested loops), each loop can have a name, > and the exit statement can exit out of two or more nested > loops by using the name of the level to get out of. > > Java has a construct that can do something like that. > Does C++ ? No. However, a 'return' from the middle of a function (even from within the deepest nested loops) is possible. Another way, especially designed for error handling, are exceptions which allow "returning" from many function call levels while cleaning up and leaving the program in a well- defined, clean state through calling the destructors of all stack-based objects on the way. However this requires some care from the programmer - you have to code in an "exception- safe" manner. I believe Ada also has exceptions, but I don't know if they work in the same manner. Does Ada have some equivalent of C++ constructors and destructors? Falk