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-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!postnews.google.com!not-for-mail From: azdo_b@yahoo.es (Alberto) Newsgroups: comp.lang.ada,comp.lang.c++,comp.realtime,comp.software-eng Subject: Re: [OT] Re: Teaching new tricks to an old dog (C++ -->Ada) Date: 11 Mar 2005 00:05:06 -0800 Organization: http://groups.google.com 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> <1lr611thktbau$.1dj95z21h7l5v.dlg@40tude.net> NNTP-Posting-Host: 80.58.1.42 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1110528306 17118 127.0.0.1 (11 Mar 2005 08:05:06 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 11 Mar 2005 08:05:06 +0000 (UTC) Xref: g2news1.google.com comp.lang.ada:9111 comp.lang.c++:45088 comp.realtime:1254 comp.software-eng:4822 Date: 2005-03-11T00:05:06-08:00 List-Id: "Dmitry A. Kazakov" wrote in message news:<1lr611thktbau$.1dj95z21h7l5v.dlg@40tude.net>... > > 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: > 2. C++ has no truly dynamic classes. But if it some time will, then how > would it deal with: > [snip example] I have never done or needed to do this, but I'll make a few tests with the compiler anyway... > 3. The size of all exception objects has an upper bound. What is the advantage here? :) > 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. If Some_Array is any array supplied at run-time, how can the compiler know what values are stored in A'Range? (I mean, what the bounds of the array are) It *has* to check these bounds at run-time. This behaviour is also easily done with C++, creating a 'bounds' class, similar to A'Range. The only difference is that it is a mechanism provided by the user and not the compiler. > > 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... Sorry, I don't understand you very well here. > 2. C++ is unable to allocate objects of indefinite size on the stack. Well, we have alloca() for this ;)