Path: utzoo!attcan!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!ames!claris!outpost.UUCP!peirce From: peirce@outpost.UUCP (Michael Peirce) Newsgroups: comp.sys.mac.programmer Subject: Re: Pascal deficiency? Message-ID: <0B010004.kmq00z@outpost.UUCP> Date: 17 Dec 90 23:09:02 GMT Reply-To: peirce@outpost.UUCP Organization: Peirce Software Lines: 36 X-Mailer: uAccess - Mac Release: 1.0.3 In article , aberno@questor.wimsey.bc.ca (Anthony Berno) writes: > > I generally prefer Pascal programming, but I have come up against what > seems like a real deficiency in the language. I never really thought > about it before, but there does not seem to be any equivalent to > the ++ or -- operator in Pascal. I was doing some speed checks on > array accessing today, and it occured to me that in doing something > like incrementing an entry by one, the computer was doing rather a > lot of work! > > Either there is no way to do a quick increment in Pascal, or I'm missing > something in my knowledge, or I'm wrong about the speed difference between > things like > ++(variable) and > (variable):=(variable)+1 > > Any comments? This is pretty basic, I know, but I never considered it > before. :) Excuse me while I go get my asbestos suit on. Using X := X + 1; rather than the c style X++; is more a matter of style than substance. Just to make sure I Iooked at the code generated from a "X := X + 1;" statement (using DUMPOBJ in MPW) and found the use of "ADDQ.W #$1,-2(A6)". The same instruction was generated by C for both "X++;" and "X = X + 1;" too. Don't worry, be happy. Pascal does a pretty good job for you. -- michael -- Michael Peirce -- {apple,decwrl}!claris!outpost!peirce -- Peirce Software -- Suite 301, 719 Hibiscus Place -- Macintosh Programming -- San Jose, California 95117 -- & Consulting -- (408) 244-6554, AppleLink: PEIRCE