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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f849b,b8d52151b7b306d2 X-Google-Attributes: gidf849b,public X-Google-Thread: 103376,a00006d3c4735d70 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-12-31 05:52:18 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsmm00.sul.t-online.com!t-online.de!news.t-online.com!not-for-mail From: Martin Krischik Newsgroups: comp.arch.embedded,comp.lang.ada Subject: Re: Certified C compilers for safety-critical embedded systems Followup-To: comp.arch.embedded Date: Wed, 31 Dec 2003 12:02:48 +0100 Organization: AdaCL Message-ID: <1100298.aDyqMtGeoM@linux1.krischik.com> References: <3fe00b82.90228601@News.CIS.DFN.DE> <3FE026A8.3CD6A3A@yahoo.com> <3bf1uvg2ntadvahfud2rg6ujk24sora6gr@4ax.com> <2u3auvogde8ktotlaq0ldiaska3g416gus@4ax.com> <20619edc.0312221020.3fd1b4ee@posting.google.com> <20619edc.0312222106.3b369547@posting.google.com> <45cs9hAbLc6$EAAx@phaedsys.demon.co.uk> <3fe9f0d7.104475725@News.CIS.DFN.DE> <5802069.JsgInS3tXa@linux1.krischik.com> <1072464162.325936@master.nyc.kbcfp.com> <1563361.SfB03k3vvC@linux1.krischik.com> <11LvOkBBXw7$EAJw@phaedsys.demon.co.uk> <3ff0687f.528387944@News.CIS.DFN.DE> <1086072.fFeiH4ICbz@linux1.krischik.com> <3ff18d4d.603356952@News.CIS.DFN.DE> <1731094.1f7Irsyk1h@linux1.krischik.com> <3ff1b8ef.614528516@News.CIS.DFN.DE> <3ff21255.637418757@News.CIS.DFN.DE> Reply-To: krischik@users.sourceforge.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: news.t-online.com 1072878682 00 32662 JkYvGcbJwHeCyiH 031231 13:51:22 X-Complaints-To: usenet-abuse@t-online.de X-ID: SSyqdTZYweTK18z2QwbcIhOWTYZHNcVa3G2V88I9RV8tRW1zY-qEZ5 User-Agent: KNode/0.7.2 Xref: archiver1.google.com comp.arch.embedded:6438 comp.lang.ada:3984 Date: 2003-12-31T12:02:48+01:00 List-Id: Dave Hansen wrote: > On Tue, 30 Dec 2003 21:35:10 GMT, Ed Falis wrote: > >>On Tue, 30 Dec 2003 19:20:50 GMT, Dave Hansen wrote: > [...] >>> while ( (key = get_key()) != EXIT_KEY ) >>> process(key); >>> >>> How do you do that in Ada? >>> >> >> >>with Get_Key, Process; >>-- Assuming appropriate declarations elsewhere >> >>procedure Do_it is >> Key: Character; >> Exit_Key : constant Character := 'X'; >>begin >> loop >> Key := Get_Key; >> exit when Key = Exit_Key; >> Process (Key); >> end loop; >>end Do_It; > > Thanks. It was a serious question. I did want to know. > > Though structurally, this reminds me of > > while (1) /* or for (;;) if you like obscure syntax */ > { > key = get_key(); > if (key == EXIT_KEY) break; > process(key); > } > > which tends to be discouraged. In Ada the exit is at the front of the statement and therefore easier to spot. > Another question: Note that in C, even though get_key takes no > parameters, it is called with empty parentheses, while Get_Key in Ada > looks (syntactically) like any other variable. ISTR that in Modula-2, > a function that takes no paramters could be called either way (with or > without empty parentheses). Is this true in Ada? FWIW, I like the > empty parens because they signal to the reader that something special > is going on. Well, no. This is partly because of the way rename works: http://www.adaic.org/standards/95lrm/html/RM-8-5-4.html http://www.adaic.org/standards/95lrm/html/RM-3-5-1.html (you don't need to pay $18 to read it ;-)) Look aut for the renamings of "red" ;-). Not every function is actualy a function. With Regards Martin -- mailto://krischik@users.sourceforge.net http://www.ada.krischik.com