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!proxad.net!fr.ip.ndsoftware.net!feeder.enertel.nl!nntpfeed-01.ops.asmr-01.energis-idc.net!feeder.xsnews.nl!feeder.news-service.com!post.news-service.com!news1.surfino.com!not-for-mail Message-Id: <4793664.vi5Yol0h1t@linux1.krischik.com> From: Martin Krischik Subject: Re: Teaching new tricks to an old dog (C++ -->Ada) Newsgroups: comp.lang.ada,comp.lang.c++,comp.realtime,comp.software-eng Followup-To: comp.lang.ada Reply-To: martin@krischik.com Date: Thu, 24 Mar 2005 14:16:49 +0100 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> <1111607633.301232.62490@z14g2000cwz.googlegroups.com> Organization: None User-Agent: KNode/0.8.0 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Complaints-To: abuse@surfino.com NNTP-Posting-Host: 83.169.175.19 (83.169.175.19) NNTP-Posting-Date: Thu, 24 Mar 2005 15:04:04 +0100 X-Trace: becdf4242c8d4f60c0ab614588 Xref: g2news1.google.com comp.lang.ada:9906 comp.lang.c++:47069 comp.realtime:1682 comp.software-eng:5288 Date: 2005-03-24T14:16:49+01:00 List-Id: Jerry Coffin wrote: > Speaking of strings, I'll digress for a moment: personally, I find it a > bit humorous when Ada advocates talk about things like having five > string types as an advantage. IMO, the need, or even belief, that five > string types are necessary or even useful is a _strong_ indication that > all five are wrong. Actualy there are only 3 of them. And they are usefull - two examples: I have worked a lot with SQL and I allways wound it cumbersome to map the SQL string type to C++. Most SQL string types are bounded - they have a maximum size. std::string (and IBM's IString) is unbounded - so before you can store your string inside the database you have to make a sanity check. In Ada I could use Ada.Strings.Bounded_Strings instead. The other example is CORBA. CORBA has two string types: string and sting. In C++ both a mapped to std::string - and the CORBA/C++ mapping must check the size of the sting. In Ada they are mapped to Ada.Strings.Unbounded_Strings and Ada.Strings.Bounded_Strings. > Ada's exception handling is also primitive at best (exceptionally so, > if you'll pardon a pun). In particular, in Ada what you throw is > essentially an enumaration -- a name that the compiler can match up > with the same name in a handler, but nothing more. Only exact matches > are supported and no information is included beyond the identity of the > exception. Well, Ada 95 added a 200 character informations string. > In C++ you can throw an arbitrary type of object with an arbitrary > value. All the information relevant to the situation at hand can be > expressed cleanly and directly. The usual inheritance rules apply, so > an exception handler can handle not only one specific exception, but an > entire class of exceptions. Again, this idea can be expressed directly > rather than as the logical OR of the individual values. And, once > again, the addition of tagged records to Ada 95 testifies to the fact > that even its own designers recognized the improvement this adds in > general, but (whether due to shortsightedness, concerns for backward > compatibility or whatever) didn't allow this improvement to be applied > in this situation. All true. But does that powerfull contruct works inside a multi tasking environment. It is indeed true that Ada exeptions are restricted - but they are thread save. And thead save means that an exception may be raised in one thead and caugth in another. Exceptions raised inside an rendevous may even be caught in both threads participating in the rendevous. And tread save is not all. An Ada system implementing the (optional) Annex E needs exeptions which can be passed from one process to another. Both processed runing on different computers. Just like CORBA exceptions. With Regards Martin -- mailto://krischik@users.sourceforge.net Ada programming at: http://ada.krischik.com