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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no 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!postnews.google.com!y80g2000hsf.googlegroups.com!not-for-mail From: "kevin cline" Newsgroups: comp.lang.ada Subject: Re: why learn C? Date: 1 Apr 2007 22:27:40 -0700 Organization: http://groups.google.com Message-ID: <1175491660.511530.58430@y80g2000hsf.googlegroups.com> 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> NNTP-Posting-Host: 76.186.24.40 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1175491662 32480 127.0.0.1 (2 Apr 2007 05:27:42 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 2 Apr 2007 05:27:42 +0000 (UTC) In-Reply-To: <6XbPh.4025$u03.802@newssvr21.news.prodigy.net> User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: y80g2000hsf.googlegroups.com; posting-host=76.186.24.40; posting-account=Thx6EwwAAAAirqf96i7UdETSL0vfyj5f Xref: g2news1.google.com comp.lang.ada:14715 Date: 2007-04-01T22:27:40-07:00 List-Id: On Mar 30, 12:39 pm, wrote: > "kevin cline" wrote in message > > news:1175230700.925143.28490@n59g2000hsh.googlegroups.com... > > > Ada gives you low-level type safety out of the box, but does not > > afford the tools necessary to achieve type-safety in high-level > > programming. Low-level C++ coding is not type safe, but C++ provides > > powerful mechanisms to write high-level type-safe code. > > On reading the Grein paper, it is clear that the advantage is a very > small, and very narrowly focused one. To me, it's a large advantage, and not narrowly focused at all. I would think the inability to perform complete compile-time checking of physical units would be pretty serious in real-time control applications. Do Ada programmers make do with run-time type checking, or just write more and more generic function instantiations until the application is finished? The rest of use have more important things to do. Any suggestion that C++ > is, as a general principle, safer than Ada is simply a fantasy. It's not safer, AS A GENERAL PRINCIPLE. But in the hands of experts, C ++ allows compile-time type checking that is impossible in Ada. > > Overall, compile-time safety in Ada is substantially superior to that > in C++. C and C++ are highly error-prone. ... when used by poorly lead mediocre programmers. > Programmers who > choose C++ take for granted that long hours of debugging obscure > errors is the way life ought to be. No doubt some programmers do. Good C++ programmers don't. I certainly don't. > As for high-level programming, this is where Ada does excel. Not for most of us, because the advantages in safety are overwhelmed by the increased verbosity. > For > large-scale, multi-developer projects C++ simply is a mess. There > is no dependable model for separate programming. Oh yes, those > CPP files! Well, they are inherently part of their own specification > and they need to be augmented by compiler directives just to make > sure there are not errors. > > I nearly guffawed when reading your last sentence. C++ as type > safe? What a joke. Sadly, I suspect you actually believe this. > > With all mechanisms available in Ada for developing solid, dependable > code and a language definition that focuses on creating compilers that > maximize the amount of error detection that can be done early in > the development process, I wonder whether you really understand > Ada at all. Have you any understanding of the visbility rules? This > goes well beyond type-safety. Do you understand the library model > and how it affects separate compilation? Do you understand how unimportant those theoretical considerations are for those of us faced with time-to-market pressure? Do you understand how the start of the art in C++ compilers and C++ programming has advanced since Ada-95 was introduced? > > As for the safety of generics, Grein's paper, which you take delight > in citing, does not discount the fact that most generic constructs > are type-safe at compile time. Further, getting it right, with C++ > templates is no trivial feat either. Actually, it's pretty trivial once you learn to think at the right level of abstraction. And if no one on a team can think at the right level of abstraction, you will end up with a mess regardless of the language chosen. > There are plenty of opportunities > to create errors in C++ templates. > > I have programmed in both languages. How much? > I have taught C++ Which textbook did you use? > and I have > taught Ada. I have colleagues who use both languages who realize > that C++ is far more error-prone than Ada. While one can get a > good set of working software in C++ using heroic efforts, Heroic efforts are not necessary. These days, about all that is necessary is to avoid writing code that produces compiler warnings. the chance > of errors in a C++ program is much higher in a corresponding program > written in Ada. I find it strange that anyone who understands both > languages well would come to any other conclusion. For me, the short reason is that Ada generics are not as powerful as C+ + templates. The power of C++ templates has enabled me to write compact, efficient type-safe application code at a very high level in a way which is not possible in Ada.