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,FREEMAIL_FROM autolearn=ham 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-30 16:07:45 PST Path: archiver1.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!mail.nartron.COM!not-for-mail From: iddw@hotmail.com (Dave Hansen) Newsgroups: comp.arch.embedded,comp.lang.ada Subject: Re: Certified C compilers for safety-critical embedded systems Date: Wed, 31 Dec 2003 00:11:37 GMT Message-ID: <3ff21255.637418757@News.CIS.DFN.DE> 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> NNTP-Posting-Host: mail.nartron.com (216.65.187.224) X-Trace: news.uni-berlin.de 1072829263 1330723 216.65.187.224 ([97677]) X-Newsreader: Forte Free Agent 1.21/32.243 Xref: archiver1.google.com comp.arch.embedded:6410 comp.lang.ada:3974 Date: 2003-12-31T00:11:37+00:00 List-Id: 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. 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. Regards, -=Dave -- Change is inevitable, progress is not.