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-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!newsfeed.arcor.de!news.arcor.de!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: [OT] Re: Teaching new tricks to an old dog (C++ -->Ada) Newsgroups: comp.lang.ada,comp.lang.c++,comp.realtime,comp.software-eng User-Agent: 40tude_Dialog/2.0.14.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH 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> Date: Thu, 10 Mar 2005 14:42:52 +0100 Message-ID: <1lr611thktbau$.1dj95z21h7l5v.dlg@40tude.net> NNTP-Posting-Date: 10 Mar 2005 14:39:34 MET NNTP-Posting-Host: acd305d1.newsread2.arcor-online.net X-Trace: DXC=_Yn On 10 Mar 2005 03:59:47 -0800, Alberto wrote: > 1. Is Ada case-insensitive as Pascal? In that case, Ada==ADA Well, Ada is not English. So Ada's rules about names are not applicable to Ada's name. BTW, with C++ it is even worse: "C++" isn't a valid C++ name! Though it nicely reflects the semantic of its usage: use what we have now, it will be better later! (:-)) > 2. The C++ exception mechanism should be very similar to aDa's, > because it was inspired partially from it [1]. Yes, but there is a sufficient difference. Ada's exceptions are values of same predefined type. It has advantages and disadvantages. Being on Ada's side I start with advantages and leave disadvantages to you: 1. exception when A => ... when B => ... is strictly equivalent to exception when B => ... when A => ... 2. C++ has no truly dynamic classes. But if it some time will, then how would it deal with: class BaseException { public : virtual void TellStories () = 0; }; try { ... { // Nested int I = 123; class NewException : public BaseException { public void TellStories () { printf ("%d", I); } }; throw NewException (); } ... } catch (BaseException& Error) { Error.TellStories (); } 3. The size of all exception objects has an upper bound. > 3. Many of you want us to believe that ADa performs ra nge checking > without loss of performance: it can be true at compile time with fixed > ranges, but it can't definitely be done without chechinkg array bounds > every time data is accessed if we don't know these bounds before > compiling (e.g.: typical cases where dynamic allocation of memory is > used) But even then bounds checking is not needed for every access. Example: procedure Dynamic (A : Some_Array) is subtype Index is Array_Index range A'Range; J : Index := A'First; for I in A'Range loop A (I) := .. -- No checks ... J := I; end loop; A (J) := ... -- Still no checks C++ completely lacks the notion of constrained subtypes which makes the above possible. > 4. Also, some people wrote that C++ is bad because it is difficult > (but not imposible, see Comeau C++) to follow 100% the Standard. The > same can be said to adA, because at least if we own a compiler of the > '83 Standard, we can't have the derivation a virtual function > mechanisms, only interfaces (pure virtual classes)[2]. To me, it > sounds reasonable to work with the last version of a compiler when > possible. As long as you have only one compiler vendor... > 5. In fact, there are standard mechanisms (STL) to handle these array > bound checking issues with ease. They cannot be so effective as in Ada. 1. See above about constraining. 2. C++ is unable to allocate objects of indefinite size on the stack. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de