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!news.cs.univ-paris8.fr!newsfeed.vmunix.org!feed.news.tiscali.de!news.belwue.de!news.tu-darmstadt.de!tsicnews.teliasonera.com!news.otenet.gr!news.grnet.gr!newsfd02.forthnet.gr!not-for-mail From: Ioannis Vranos 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: Sat, 05 Mar 2005 22:44:18 +0200 Organization: FORTHnet S.A., Atthidon 4, GR-17671 Kalithea, Greece, Tel: +30 2109559000, Fax: +30 2109559333, url: http://www.forthnet.gr Message-ID: <1110055473.613245@athnrd02> 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> <87eket97gp.fsf@insalien.org> NNTP-Posting-Host: athnrd02.forthnet.gr Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: athprx02.forthnet.gr 1110055473 24933 193.92.150.73 (5 Mar 2005 20:44:33 GMT) X-Complaints-To: abuse@forthnet.gr NNTP-Posting-Date: Sat, 5 Mar 2005 20:44:33 +0000 (UTC) User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en In-Reply-To: <87eket97gp.fsf@insalien.org> Cache-Post-Path: newsfd02!unknown@ppp36-adsl-149.ath.forthnet.gr Xref: g2news1.google.com comp.lang.ada:8675 comp.lang.c++:44216 comp.realtime:959 comp.software-eng:4490 Date: 2005-03-05T22:44:18+02:00 List-Id: Ludovic Brenta wrote: > 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. You can also express constraints in templates. An important thing is this. Are Ada's generics run-time or compile time? As I said in another message of mine, in C++ you can "plug in" whatever you want by using third-party libraries and frameworks. For example in .NET 2, C++ will have both its compile-time templates and .NET's 2 run-time generics (with the keyword generic). > 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!). It looks like they are run-time, and in C++ you can do all the above. Actually Ada's compilers are probably written in C++. > 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? I suppose you mean multithreading. You can do that in C++ in many different ways, by "plugging in" the necessary facilities: By using the OpenMP standard (http://www.openmp.org) #include int main() { using namespace std; vector somearray(10); #pragma omp for for(vector::size_type i=0; iDoSomething() pthread1->Start(); //Start execution of ps->DoSomethingElse() pthread2->Start(); // ... The are innumerable ways that you can do things in C++, you just 'plug in" the additional facilities that you want. > 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". Do you know std::bitset? > > 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. In C++ you can be as safe, restricted and convenient as you want. -- Ioannis Vranos http://www23.brinkster.com/noicys