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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 109fba,304c86061dc69dba X-Google-Attributes: gid109fba,public X-Google-Thread: 103376,5cb36983754f64da X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-02-11 02:56:36 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed-west.nntpserver.com!hub1.meganetnews.com!nntpserver.com!newshosting.com!nx02.iad01.newshosting.com!border1.nntp.ash.giganews.com!border2.nntp.sjc.giganews.com!border1.nntp.sjc.giganews.com!nntp.giganews.com!local1.nntp.sjc.giganews.com!nntp.adelphia.com!news.adelphia.com.POSTED!not-for-mail NNTP-Posting-Date: Wed, 11 Feb 2004 04:56:34 -0600 From: Jerry Coffin Newsgroups: comp.lang.ada,comp.lang.c++ Subject: Re: No call for Ada (was Re: Announcing new scripting/prototyping language) Date: Wed, 11 Feb 2004 04:03:22 -0700 Message-ID: References: <20040206174017.7E84F4C4114@lovelace.ada-france.org> <54759e7e.0402071124.322ea376@posting.google.com> <2460735.u7KiuvdgQP@linux1.krischik.com> <54759e7e.0402081525.50c7adae@posting.google.com> Organization: TAEUS X-Newsreader: MicroPlanet Gravity v2.50 NNTP-Posting-Host: 68.64.173.106 X-Trace: sv3-uNdsSAlwwfbwSJ2MGb6SwBLJ4s6Ct9TflCZCZhaGWGsTFa0xXiIpK1vAnadQ50wlmEjKFa7b/MicSmj!jnNuXFmCniETWAwTTTQ91GSDQ+e3Fp5QLBEKLQkyq6llyzRcrscPGBGqxOQyeJFidQ3hTNVh7okB!Gv7oNo3O/UpUGvNHng0qbcA= X-Complaints-To: abuse@adelphia.com X-DMCA-Complaints-To: abuse@adelphia.com X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Xref: archiver1.google.com comp.lang.ada:5425 comp.lang.c++:18647 Date: 2004-02-11T04:03:22-07:00 List-Id: In article , ludovic.brenta@insalien.org says... [ ... ] > And think about the implications of these ranges on subprograms that > accept only a small set of integer constants as a parameter: > > type Assessment is (Yes, No, Maybe, Maybe_Not); > > procedure P (A : Assessment); > > which is not possible in C: > > typedef enum { YES, NO, MAYBE, MAYBE_NOT } assessment_t; > > void P (assessment_t A) { } > > int main () { > P (42); // no compiler check! > return 0; > } > > I just tried the above with gcc -Wall and got no warning. Since you're cross-posting to c.l.c++, perhaps you'd have the kindness to also check this as a C++ program. If you do so, you'll find that either the program is rejected, or else your C++ compiler is drastically broken. If you insist on only compiling it as C, at least use a good compiler. Comeau C (for one example) produces the following in C mode: "enum.c", line 6: warning: enumerated type mixed with another type P (42); // no compiler check! ^ > This means that only a human carefully reviewing this program will see > the mistake A fundamental mistake: assuming that one compiler's inferiority means something about the language itself, or even about other compilers. > (you may also try lint, but this is a tool external to the > language and based on heuristics, not language rules). I'd use a C++ compiler, and know that it was simply enforcing a requirement of the language. As you can see above, even if I compiled it as C, it would be found. > By contrast, > the Ada compiler catches the mistake automatically in seconds and > leaves you with the confidence that 100% of your code has been > screened for such stupid mistakes. ...and there's the complacency typical of all too many Ada programmers! A properly functioning Ada compiler will catch _this_ stupid mistake just as well as a C++ compiler will -- but assuming that means it will catch all such stupid mistakes is taking a leap well beyond reality. -- Later, Jerry. The universe is a figment of its own imagination.