Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!ucsd!ucbvax!bloom-beacon!eru!hagbard!sunic!news.funet.fi!assari.tut.fi!assari.tut.fi!n67786 From: n67786@lehtori.tut.fi (Nieminen Tero) Newsgroups: comp.sys.mac.programmer Subject: Re: Pascal deficiency? Message-ID: Date: 18 Dec 90 17:25:54 GMT References: <16650@imag.imag.fr> Sender: news@assari.tut.fi (USENET News System) Organization: Tampere Univ. of Technology, Finland. Lines: 41 In-Reply-To: gourdol@imag.imag.fr's message of 18 Dec 90 20:50:37 GMT In article <16650@imag.imag.fr> gourdol@imag.imag.fr (Gourdol Arnaud) writes: Writing optimisation for Pascal IS more difficult than for C, in the sens that in C, when we use the ++ operator you say to the compiler "Hey, stupid, don't forget to use the INC operator that exist in assembly language!" When you do i := i + 1; in Pascal, the compiler must detect that it can (and should) use the inc operator. Much more difficult when the expression is a bit complicated (like a[i]). If the C compilers optimization is any good it WILL notice such cases too. But this kind of optimization is not in any way illegal in Pascal and it's the compilers defect not to catch it (be that C or Pascal compiler, or any other for that matter). I would rather say that since C language is so much closer to machine level, you might be tempted to consider programmers decisions better optimization than what the compiler could produce. It hasbeen proven many times that in non trivial cases Fortran compilers produce better code for accessing elements of array than equivalent C compiler even though the Fortran code uses indexes in stead of pointers (at least in source code level). What exactly the compiler output is is entirely up to the compiler (like it should be in my opinion). In the era of pipelined processor architecture it is especially wise to leave the optimization for the compiler. And the less the language has to do with the hardware the easier it should be to make the compiler optimizing optimal (since it doesn't need to watch out for any bad decisions made by the programmer). There is still no good compiler on the Mac (except GCC maybe ?) either in C or Pascal. True enough. Or for any other language for that matter. (Of course, LSP and LSC are REAL love for programming and debugging as compared to cc, dbx and adb on Sun !!!) Arnaud. -- Tero Nieminen Tampere University of Technology n67786@cc.tut.fi Tampere, Finland, Europe