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,bd45e29f9dafca87 X-Google-Attributes: gid103376,public From: Gautier Subject: Re: bitwise comparators Date: 2000/01/17 Message-ID: <3883812B.5B93E902@maths.unine.ch>#1/1 X-Deja-AN: 573887944 Content-Transfer-Encoding: 7bit References: <3880D375.7E363123@hotmail.com> <38829638.0@news.pacifier.com> <3882FC1C.2BA8C959@hotmail.com> <38834F16.FE5DE77F@hotmail.com> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Trace: 17 Jan 2000 20:51:36 +0100, 130.125.13.32 MIME-Version: 1.0 Newsgroups: comp.lang.ada Date: 2000-01-17T00:00:00+00:00 List-Id: << 1 Strong typing 2 Multitasking 3 Generics 4 Tagged Types 5 Packages 6 Exceptions 7 Discriminants 8 Arrays indexed over arbitrary ranges, including enumerations 9 Much greater control over variable range and representation 10 Runtime error checking >> Alexander Van Hecke: > I'm not sure why you think these features are more _powerful_ than in C. * Take the example of exceptions (but the tasking, that I don't practice, is a better one). With the years, compiler makers tend to implement them the most efficiently (zero-cost when no exception occurs, at least). If you want to program it in C, you have to invent them; for years your home-made exception model will be slow, will crash a lot etc. And it won't work on another machine, compiler or even memory model. Other C resources won't be able to use them; if they use them, exception codes will interfer. * So you will avoid exceptions, but you'll have to carry error codes everywhere in the process -> slower. (I think to Unzip - see http://members.xoom.com/gdemont/unzipada.htm ) * This is an example where features are a the same time advanced _and_ powerful. Among the list, 1,2,6,9 (at least) are effectively used by optimizers in GNAT Ada 95 and DEC Ada (83) - the compilers I know. A real Ada bonus. 1-9 save a huge portability effort, 10 (that uses 1-9) save incredible time of run-time debugging. I'll add that 1,8,9 catches most errors at compile-time: it means that the 1/100 sec of slower Ada compilation replace 1 hour of debugging in Fortran/C... > I'd label these features as more _advanced_. C is an old language (allthough I'm > not sure at all about Ada), Ada (83) is about 20 years younger... > but nearly all those things you sum up are > _possible_ in C, maybe they're not as easy as in Ada and require the programmer > to explicitly program them (which may take a lot of code), but they're > possible. Of course. You can even program it in assembler ;-). It depend ho many lifes you have to do it! Seriously: to implement basic features of Ada, say * packages (getting rid of makefiles with a working auto-make, check .h against .c) * exceptions (*working* exceptions - read c++ ngs to see that it is not trivial) * generics (same remark about c++ templates...) * strong type, with possibility of checking bounds as your home-made C preprocessor and you'll be very old! > Don't get me wrong, I'm not trying to make Ada look bad here, but I think my > previous statement stands : suppose you have no previous programming experience > whatsoever, I think that C is a lot easier to learn than Ada is. I'd say that > Ada is a more advanced language (i.e. has more advanced features), as there are > many languages that are more advanced than C. My idea about easy or not: all psychological, a question of image. * C has a better image (the funny 1960 experimental macro-assembler, the hippie era) * Ada has an horrific one (government, army, commitee, heavy, expensive). This image has improved much over the past 4 years thanks to GNAT, the Ada95 norm and fast computers that reach decent compilation times. More is to be done... A problem with Ada (IMHO): some Ada advocates are a bit arrogant, prefer to boast that one can do such and such thing in Ada instead of showing simple examples, providing resources on the Internet. Many people just didn't see Ada sources! > Again, I'm not trying to start a heavy discussion here about C versus Ada. It seems well started I fear! No problem if this is argumented and not (too) religious... -- Gautier _____\\________________\_______\ http://members.xoom.com/gdemont/