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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e28ffe0eaf31d1b6 X-Google-Attributes: gid103376,public From: rodemann@mathematik.uni-ulm.de (Joerg Rodemann) Subject: Re: Ada vs C++ Date: 1997/09/09 Message-ID: <34150637.0@news.uni-ulm.de>#1/1 X-Deja-AN: 270924506 References: <34090462.4652@easystreet.com> <340C47F8.670B@osc.edu> Organization: University of Ulm, SAI, Germany Newsgroups: comp.lang.ada Date: 1997-09-09T00:00:00+00:00 List-Id: James B. White, III (Trey) (trey@osc.edu) wrote: > The ability of C++ compilers to infer template instantiations may be > dangerous, but it allows the construction of incredibly powerful > interfaces. Combined with the ability to inline functions, you can write > strange constructions called "expression templates" and "template > metaprograms" that perform optimizations that are extremely difficult or > impossible for a compiler to perform on its own. > Ada may have advantages over C++, but only C++ allows these incredibly > powerful programming techniques. Unfortunately, the techniques are also > incredibly complicated and incredibly ugly. The resulting interface, > however, can be elegant. For more information, see the following > references by the inventor, Todd Veldhuizen. I wonder how this will work on non-standard highend machines. As far as I can see --- if all you need is a) very high computational power (number crunching) b) use of already existing numerical libraries c) good support by the vendor on such machines you most of the time are left with f77 or maybe f90 or even HPF. Perhaps the C compiler does work properly too. If you use C++ and desire at least a bit of portability forget about nested librarie and i.e. templates. Template instantiation still seems to be a serious problem for compiler writers her --- and although normal desktop machines are already capable of get this thing right...on the highend machines I worked on this left us with a real mess. Sure, there are workarounds available but they neither increase readability nor are they portable at all (all those pragmas concerning instantiation.) The more complex your templates are the more likely is it that they will fail. On desktop machines I think this power hunting does not make much sense. A factor of 2 or 3 in speed is clearly serious but only if you intend to run the code for a long time (months to years). Otherwise a gain in shorter development time may prove much more important than anything else. (I saw people spending weeks with number crunching just to throw away the results because the discovered a missing - in -= or a = instead of a == or some similiar silly bug. (Many were related to memory leaks and faulty vector access. Multi-dimensional arrays are not that easy in C as one would guess. :-) ). Those template constructs seem be similarly errorprone to me. And --- which debugger will help you there? Sorry for my sceptical view here, it's of course just my opinion. Yours Joerg -- rodemann@mathematik.uni-ulm.de | Dipl.-Phys. Joerg S. Rodemann Phone: ++49-(0)711-5090670 | Flurstrasse 21, D-70372 Stuttgart, Germany -------------------------------+--------------------------------------------- rodemann@rus.uni-stuttgart.de | University of Stuttgart, Computing Center Phone: ++49-(0)711-685-5815 | Visualization Department, Office: 0.304 Fax: ++49-(0)711-678-7626 | Allmandring 30a, D-70550 Stuttgart, Germany