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!news1.google.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "Martin Dowie" Newsgroups: comp.lang.ada,comp.lang.c++,comp.realtime,comp.software-eng Subject: Re: Teaching new tricks to an old dog (C++ -->Ada) Date: Wed, 9 Mar 2005 14:52:44 -0000 Organization: BAE SYSTEMS Message-ID: <422f0c08$1_1@baen1673807.greenlnk.net> 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> X-Trace: individual.net AdyKc8BpuXhrkMwS098UFwWAoOQnxP6fyKo5OgitdLygFyCslw X-Orig-Path: baen1673807.greenlnk.net!baen1673807!not-for-mail X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700 X-Original-NNTP-Posting-Host: baen1673807.greenlnk.net Xref: g2news1.google.com comp.lang.ada:8933 comp.lang.c++:44767 comp.realtime:1126 comp.software-eng:4684 Date: 2005-03-09T14:52:44+00:00 List-Id: Hans Malherbe wrote: > * 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? Of course you can! > * case statements (Ada's equivalent of a switch in C++) are required > to handle all possible cases. Thus it is impossible to forget one. > And, of course, there is no "break;" crap in Ada. > > Prevents fall through. Call a common function/procedure > A few other questions: > > Do you have nested functions like Pascal have? Yes > Can you access local variables? Don't understand what you mean. > Can you pass pointers to these functions around? Yes, you can pass 'pointers' to functions around - this is being enhanced futher in Ada2005, so that at compile time you can guarentee never to pass a 'NULL' value. > Can you pass non-type parameters (like the number 3.14) to templates? Yes, you can pass nearly anything. > Can you program "const correct"? Eg. if you declare a member function > as const the compiler will help you not mutate the object or call any > functions that do. Also, if you pass a parameter as a const reference, > you will not be able to mutate the object the parameter references. Yes but Ada does not require the programmer to define what parameter passing mechanism to use. It instead defines parameter 'modes' that basically indicate the 'logical flow' of the data being passed. Parameters of mode 'In' can only be read. Cheers -- Martin