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: 1014db,dab7d920e4340f12 X-Google-Attributes: gid1014db,public X-Google-Thread: 103376,dab7d920e4340f12 X-Google-Attributes: gid103376,public From: nasser@apldbio.com (Nasser Abbasi) Subject: Re: C is 'better' than Ada because... Date: 1996/06/22 Message-ID: #1/1 X-Deja-AN: 161602694 sender: news@biosys.apldbio.COM references: <4q8fbo$701@red.interact.net.au> to: Alan Brain original-sender: nasser@apldbio.com followup-to: comp.lang.ada organization: Applied BioSystems newsgroups: comp.lang.ada,comp.lang.c Date: 1996-06-22T00:00:00+00:00 List-Id: From: Alan Brain Newsgroups: comp.lang.ada,comp.lang.c Date: 19 Jun 1996 08:56:24 GMT ..snip.. I've finally become convinced that C really IS better than Ada, for the following reasons: (good stuff removed...) But i must admonish you in public for not mentioning one more good reason why C/C++ is better than Ada , see why for yourself, below is are simple programs to print an array. How simpler than this can you get? I want to print the first 10 elements in my array, but Ada will NOT allow me to do even this simplest of tasks, the thing keeps raising some exception telling me I went over the boundary of my array (what a silly execuse to stop my program from running! ) While with C/C++, I can go over the boundary of the array all I want, no hasle or fuss, and it does it all so silently too as expected, after all this is MY array ! I own this array ! It is MY computer ! and so I have all the right to traverse it as long as I want , and so a simple stright forward for loop always me to print as many elements in the array as I want, as expected. Offcourse sometimes one just have to rememeber to throw in the NULL thing somewhere near where they want to halt the string array from going too far, but that is easy, just keep few extra NULLs around for saftey and all will be well. (offcourse you need to remember to have an extra space at the end for the NULL thing so it wont get mungled with the data itself, but what the heck, easy to do , and if one forgets, I am sure there will be a NULL somewhere in memeory (espcially if you have large amount of memeory installed) to stop the array from reaching the end of the memory board, so not to worry there. Therefor one must conclude that coding in C/C++ is much simpler and gives the programmer the freedom to do what they want while Ada keeps getting its nose in our code telling us what we can and can't do. Freedom is what it is all about. ========= The Ada program with Ada.Text_Io; use Ada.Text_Io; procedure Main is I: Integer :=0; Vec : array(1..5) of Integer; begin for I in 1..10 loop Vec(I):=I ; Put_Line(" Current value is "& Integer'Image(Vec(I))); end loop; end Main; $main Current value is 1 Current value is 2 Current value is 3 Current value is 4 Current value is 5 raised CONSTRAINT_ERROR <--- Yuck! Ada will not allow me to loop Any More !! what a pain! Now I have to go change my code :( ======= the C program #include main() { int vec[5]; int i; for(i = 0 ; i < 10 ; i++ ) { vec[i] = i; cout<< " current value is " << vec[i] << endl; } } $CC test1.cc $a.out current value is 0 current value is 1 current value is 2 current value is 3 current value is 4 current value is 5 <--- Nice !! C/C++ allows me to the freedom to loop current value is 6 I dont have to change my code :) current value is 7 current value is 8 current value is 9 Nasser -- Nasser Abbasi. C/C++/Ada Solaris. GeneAssist - A client/server application for Nucleic acid and protein sequence search and analysis. PE-Applied BioSystem division. email: nasser@apldbio.com MSEE(control), MSCS, MSCE, FM(Fide Chess Master 2305 ELO 1.e4 !!)