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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,fc52c633190162e0 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!130.81.64.211.MISMATCH!cycny01.gnilink.net!spamkiller2.gnilink.net!gnilink.net!trndny03.POSTED!0e8a908a!not-for-mail From: Hyman Rosen User-Agent: Thunderbird 1.5.0.10 (Windows/20070221) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: why learn C? References: <1172144043.746296.44680@m58g2000cwm.googlegroups.com> <1172161751.573558.24140@h3g2000cwc.googlegroups.com> <546qkhF1tr7dtU1@mid.individual.net> <5ZULh.48$YL5.40@newssvr29.news.prodigy.net> <1175215906.645110.217810@e65g2000hsc.googlegroups.com> <1175230700.925143.28490@n59g2000hsh.googlegroups.com> <6XbPh.4025$u03.802@newssvr21.news.prodigy.net> <1175491660.511530.58430@y80g2000hsf.googlegroups.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <_esTh.11650$eC.2533@trndny03> Date: Thu, 12 Apr 2007 15:28:58 GMT NNTP-Posting-Host: 162.84.197.141 X-Complaints-To: abuse@verizon.net X-Trace: trndny03 1176391738 162.84.197.141 (Thu, 12 Apr 2007 11:28:58 EDT) NNTP-Posting-Date: Thu, 12 Apr 2007 11:28:58 EDT Xref: g2news1.google.com comp.lang.ada:14940 Date: 2007-04-12T15:28:58+00:00 List-Id: adaworks@sbcglobal.net wrote: > This tends to increase, not decrease, the dependability since each > instantiation is checked at compile-time. Every C++ template instantiation is done, and therefore checked, at compile-time. It's Ada that has run-time instantiation (with compile-time checking). >> Time end = integrate_until(f1 * phase_shift(f2,start) / f3 + f4, q); >> even though f1, f2, f3, and f4 were possibly of different types. > In fact, your acknowledgement of the "different types" is quite telling. Telling of what? Automatic instantiation lets generic functions come into being as programs use them. > Further, the ad hoc pointer is potentially problematic. What pointer? I see no pointer in this code. > A similar construct in Ada, using an access to a function, requires the > function to be type conformant and parameter conformant prior to being > incorporated into the construct. The C++ code has no pointers at all. The automatic instantiation done by the C++ template mechanism is similar in its goals to Ada's operator overloading. A universe of candidate functions is searched through a rules system that picks one best choice or reports an error. > However, typedef does not provide the level of type safety one would > expect in a corresponding Ada program. Typedef merely creates a synonym for a type, another name by which that type is known. It cannot increase or decrease safety in any way, although it may increase abstraction.