Path: utzoo!attcan!uunet!husc6!bloom-beacon!apple!keith From: keith@Apple.COM (Keith Rollin) Newsgroups: comp.sys.mac.programmer Subject: Re: Problems with XCMDs in MPW Object Pascal 3.0 Message-ID: <27173@apple.Apple.COM> Date: 12 Mar 89 23:48:51 GMT References: <4321@sdcc3.ucsd.EDU> <26942@apple.Apple.COM> <877@internal.Apple.COM> <15634@cup.portal.com> <27155@apple.Apple.COM> Organization: Apple Computer Inc, Cupertino, CA Lines: 49 In article <27155@apple.Apple.COM> I write: >In article <15634@cup.portal.com> Greg_Mark_Finnegan@cup.portal.com writes: > >>Here's a question for the MPW compiler hacks out there: What is the most >>efficient base index of arrays in MPW 3.0 Pascal 0 or 1? > >I just looked at the output of the following program. Neither array base >seemed offer any advantage over the other. However, I seem to recal an >instance where a zero-based array was better, but I can't remember what the >circumstances were: > I just got this note from Landon Dyer, one of the MPW engineers: ----- Keith, I didn't post this -- you may if you like.... Given zero: ARRAY[0..42] OF INTEGER; one: ARRAY[1..42] OF INTEGER; i: INTEGER; ... zero[i] := 6; one[i] := 7; With range checking turned off, the code for both array references is essentially the same. With range checking turned on (which, by the way, is the default) the compiler generates an extra SUBQ and makes use of an extra temp register. You'd have to be in dire straits indeed for this to matter much... -- Landon Dyer, Apple Computer, Inc. "Why use a REAL development Development Systems Group (MPW) system when you can bang I speak for me. a rock against your head?" ------------------------------------------------------------------------------ Keith Rollin --- Apple Computer, Inc. --- Developer Technical Support INTERNET: keith@apple.com UUCP: {decwrl, hoptoad, nsc, sun, amdahl}!apple!keith "Argue for your Apple, and sure enough, it's yours" - Keith Rollin, Contusions