Path: utzoo!utgpu!news-server.csri.toronto.edu!torsqnt!geac!aeshq!harry From: harry@aeshq.UUCP (Harry Pulley) Newsgroups: comp.sys.ibm.pc.misc Subject: Re: Turbo Pascal vs. C Keywords: C, Pascal Message-ID: <776@aeshq.UUCP> Date: 2 Oct 90 18:55:51 GMT Organization: AES Headquarters, Environment Canada, Toronto, Canada Lines: 39 I learned Pascal well before I learned C. I wrote a fractal program in Turbo Pascal which I later converted to Turbo C as an exercise in that area. I used exactly the same algorithm, the same number of iterations, the same accuracy, etc. I compiled the Pascal version normally, and the C version was optimized for speed. The result: the C version was more than 30% faster than the Pascal. I was running a 286 with a numerical co-processor. The Pascal version required 33 minuted to finish a VGA screen, while the C version only took 22 minutes. (Please note that these values are approximate; I don't have my test records with me...) I am currently working on support routines for a database on a UNIX system. To 'talk' to SQL and the database, almost all function parameters and return values must be referenced using pointers. I feel this application would be much more challenging to write in Pascal than it was in C, if not impossible. Pascal is excellent for many applications, especially those where an error overlooked by the compiler may cause damage to memory, disks, etc. C compilers will let you compile code which is obviously wrong (too many or wrong parameters, etc.), without a peep. This has created many a horrible programming experience over the years. C assumes that you know what you are doing. I have, on occasion, done some things which would be considered bad programming practice. For example, I have provided floats for a function expecting integers. The program worked alright; for that system, etc. I didn't need to do convertions before I passed the values on to the next procedure. This, in my opinion, is a definite advantage of C over Pascal. But you gotta know what yer doin'... C is currently my preferred programming language. I am, however, glad that I used Pascal prior to learing C. Except for a few Zen programming techniques (similar to the one above) I like to think that my programming style still shows some of the structure that was necessary while I was writing programs in Pascal. HCPIV { No flames intended toward Pascal users, :-) ! }