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: fac41,2c6139ce13be9980 X-Google-Attributes: gidfac41,public X-Google-Thread: 103376,3d3f20d31be1c33a X-Google-Attributes: gid103376,public X-Google-Thread: 109fba,2c6139ce13be9980 X-Google-Attributes: gid109fba,public X-Google-Thread: f43e6,2c6139ce13be9980 X-Google-Attributes: gidf43e6,public X-Google-Thread: 1108a1,2c6139ce13be9980 X-Google-Attributes: gid1108a1,public X-Google-Thread: 1014db,3d3f20d31be1c33a X-Google-Attributes: gid1014db,public From: mheaney@ni.net (Matthew Heaney) Subject: Re: Is ADA as good for graphics programming as C? (WAS: Re: Avoiding the second historic mistake) Date: 1997/07/02 Message-ID: #1/1 X-Deja-AN: 254209861 References: <33957A33.1C31AB44@oma.com> <865898351snz@nezumi.demon.co.uk> <339ED54C.215A5F85@oma.com> <5noc8u$a8m$3@miranda.gmrc.gecm.com> <33A032AC.2D8BA85C@oma.com> <5nrn86$cvo$3@miranda.gmrc.gecm.com> <33A1CBBB.B0602EC@oma.com> <5o2uls$ku3$2@miranda.gmrc.gecm.com> <33A6ADDA.2099EEB9@oma.com> <33A7D2DE.545B@polaroid.com> <33A9338D.10BB@polaroid.com> <33B09D64.E7F99DA3@saguarosoft.com> <33B16CBB.417A@gdesystems.com> Organization: Estormza Software Newsgroups: comp.object,comp.software-eng,comp.lang.ada,comp.lang.eiffel,comp.lang.c,comp.lang.c++ Date: 1997-07-02T00:00:00+00:00 List-Id: In article <33B16CBB.417A@gdesystems.com>, Michael Levasseur wrote: >My choices on the three would be: > >Graphical Engine Code written in C for maintainability and speed. > >Graphical Application written in Ada 83 or Ada 95 for maintainability, >reliability, and to keep my customers happy (DoD). > >GUI written in C++ for easy of developing. >(As long as my Code Size creap doesn't kill me :-) ) I'm curious: on what basis would you consider C superior to Ada for "maintainability and speed"? What about Ada do you think is responsible for its being not as fast as C? Have you benchmarked some code in order to make a comparison? It is my understanding that because of Cs aggressive use of type-casting, optimizations are actually more difficult to make than in Ada, where more semantic information is given to the compiler (because of the richness of its type system), thus allowing better optimization than is possible for C. In Ada, the type system is merely a tool, and of course the programmer can use it or not use it as is his desire; most _choose_ to turn on strong typing, though certainly that isn't required by the language. It would be very simple to just use the numeric types that come predefined in Ada, thus allowing you to do the same sort of loosely-typed programming that one does in C. And I've fallen into the little trap there of assuming the stronger typing is somehow less efficient. Yes, there are checks to make sure that I don't dereference an item beyond the end of an array, for example, but for the most part programmers feel these checks are beneficial, and are quite happy about not being able to clobber memory accidently. Note too that these range checks occur only when the compiler is unable to determine that the range of the index object lies within the range of the array index subtype. When the index object is more strongly typed, this gives the compiler the information it needs to turn array index checks off! Thus the idea that strong typing is less efficient is largely a myth. And even then, in spite of a strongly-typed infrastructure, the Ada programmer has an escape hatch called Unchecked_Conversion, to allow him the freedom to convert any kind of type into any other kind, with the same semantics as in C using type casts. That C is more maintainable than Ada: again, on what basis? Better maintainability would imply that one can more easily understand the code, by being able to focus on a small part at a time. This a made possible by Ada (and other languages) by providing a facility to create programmer-defined abstractions, a facility largely missing in C (when compared to other langauges). So I'm confused by the argument that C is "faster" and "more maintainable" than Ada. Perhaps you would care to eludicate your reasons for believing so. Do you have a (small) code example in C that demonstrates why you feel C is superior to Ada for writing a graphical engine? Perhaps we could then come up with an equivalent Ada example to show that Ada is not any less efficient or less maintainable. We might even be able to show that the Ada example is faster, and more maintainable. -------------------------------------------------------------------- Matthew Heaney Software Development Consultant (818) 985-1271