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,UTF8 Path: g2news1.google.com!news1.google.com!proxad.net!newsfeed1.ip.tiscali.net!tiscali!transit1.news.tiscali.nl!dreader2.news.tiscali.nl!not-for-mail 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) 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> From: Ludovic Brenta Date: Sat, 05 Mar 2005 21:13:42 +0100 Message-ID: <87eket97gp.fsf@insalien.org> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.3 (gnu/linux) Cancel-Lock: sha1:uz/TiTplb4jT+WKd8dY7vcEFyC0= MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Organization: Tiscali bv NNTP-Posting-Date: 05 Mar 2005 21:13:21 CET NNTP-Posting-Host: 83.134.241.69 X-Trace: 1110053601 dreader2.news.tiscali.nl 44096 83.134.241.69:34364 X-Complaints-To: abuse@tiscali.nl Xref: g2news1.google.com comp.lang.ada:8667 comp.lang.c++:44205 comp.realtime:951 comp.software-eng:4482 Date: 2005-03-05T21:13:21+01:00 List-Id: Ioannis Vranos writes: > In general, we cannot compare the two languages because they have > different design ideals. > > > C++ supports 4 paradigms. Each paradigm is supported well with > maximum run-time/space *efficiency*. At the same time it leaves no > room for a lower level language except of assembly. Ada's efficiency is on par with C++'s, thank you very much. In fact, the most widely used Ada compiler is none other than GCC. > On the other hand I do not know ADAs ideals (for example I do not > think it supports the generic programming paradigm - templates), Ada can teach C++ how to do templates properly. In Ada they are called "generics". The reason why Ada's generics are better (IMHO) than C++'s templates is that Ada alows you to express constraints between generic parameters. There is also a rich set of possible generic parameters. A generic parameter can be a type, an object, a subprogram, or a package (in which case the actual package must be an instance of some designated generic package!). For example, in Ada, you can say that a generic takes a type parameter which must be a subclass of some designated class. You can then go on to say that a second parameter must be an instance of that particular subclass. Ada supports procedural programming, object-oriented programming, genericity, and exceptions, just like C++. And, Ada supports multitasking. How's that for a multiparadigm language? The one thing that C++ supports that Ada doesn't is multiple inheritance. This feature was left out as unsafe. Interface inheritance à la Java is being added in Ada 2005. > but I suspect they are to be an easy (restricted to easy parts), > safe (not letting you do low level operations), application > development language, which is OK for usual application development. Ada also has low-level facilities for systems programming. These facilities allow doing bit-level programming *cleanly* and *explicitly*. An entire chapter of the Ada reference manual is devoted to this - chapter 13, "representation issues". This means that, uness you see a representation clause or uses of Unchecked_Conversion or Unchecked_Deallocation, you can pretty much assume that an Ada program uses only safe features. In Ada, unsafe programming is possible but must be explicit. There is also a gem of a language feature: pragma Restrictions. This pragma allows you to restrict usage of some language features, *and the compiler enforces the restrictions*. But the possible restrictions are implementation-defined. -- Ludovic Brenta.