Path: utzoo!attcan!uunet!lll-winken!ncis.llnl.gov!helios.ee.lbl.gov!pasteur!ucbvax!decwrl!purdue!gatech!rutgers!rochester!udel!princeton!phoenix!mbkennel From: mbkennel@phoenix.Princeton.EDU (Matthew B. Kennel) Newsgroups: comp.sys.mac.programmer Subject: Re: serious code generation bug in Lightspeed C Message-ID: <5623@phoenix.Princeton.EDU> Date: 20 Jan 89 06:38:59 GMT References: <1112@dogie.edu> <6337@hoptoad.uucp> Reply-To: mbkennel@phoenix.Princeton.EDU (Matthew B. Kennel) Organization: Princeton University, NJ Lines: 57 In article <6337@hoptoad.uucp> tim@hoptoad.UUCP (Tim Maroney) writes: >In article <1112@dogie.edu> yahnke@vms.macc.wisc.edu (Ross Yahnke, MACC) writes: >>Tim, you are simply wrong, and obstinate to belabour the issue. >>[other hosations follow...] > >(Gosh, *both* specious and untrue?) > >Ross, open your IMv2 to page 16. Got it? OK. Now, look at the three >notes under "The Lisa Pascal compiler frequently dereferences handles >during its normal operation." What is the first one? That's right, it >is about the WITH statement, and has no applicability to any C >compiler. An intelligent C compiler should perform this optimization automatically, i.e. reduction of common subexpressions. What is the third one? Yes, it concerns implicit passing by >reference of structures, something which no C compiler does, and again >has absolutely nothing to do with C. There is no reason why a C compiler couldn't do it if it could figure out that the results would conform to the standard. Suppose it realized that the called function never changed any of the values of the passed structure, but only read its contents. I would think it a reasonable optimization to only pass the address of this structure and tweak off the values from that instead of copying the whole thing onto the stack or something like that. >[more gripes follow] I agree that this problem is not explicitly mentioned in IM, but as it is also a function of specific compilers used, it is not Apple's respon- sibility to alert programmers to this fact. Indeed, a good programmer ought to be able to guess that since Lisa Pascal did in fact have this problem, that perhaps other compilers might as well. Matt Kennel mbkennel@phoenix.princeton.edu >-- >Tim Maroney, Consultant, Eclectic Software, sun!hoptoad!tim >"There are no Famous People on the net. Only some of us with bigger mouths > than others." -- Dan'l Danehy-Oakes, The Roach PS: this is my personal gripe.... Why does LSC generate such LAME code? Does it optimize ANYTHING? To be honest, I like everything about their C compiler (I bought it after all), except the compiler! On the upgrade from V2 to V3, all sorts of bells & whistles were added (very useful ones, no doubt) but the code generator did not seem to improve substantially. Sorry to be so disrespectful of an otherwise fine product, but the code generator is definitely NOT up to contemporary standards, even on microcomputers. (what do you mean? Port gcc onto a Mac 128? No problem!) :)