Path: utzoo!attcan!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!snorkelwacker.mit.edu!apple!keith From: keith@Apple.COM (Keith Rollin) Newsgroups: comp.sys.mac.programmer Subject: Re: Pascal deficiency? Message-ID: <47432@apple.Apple.COM> Date: 17 Dec 90 18:45:23 GMT References: Organization: Apple Computer Inc., Cupertino, CA Lines: 27 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 You could look into the built-in functions PREV and SUCC. However, the last time I checked them out (which was around 3.0A2 timeframe), using i := i + 1 actually generated better code. Go figure. I can't. Perhaps it's because PREV and SUCC also work with general enumerated types other than bytes, integers, and longints. -- ------------------------------------------------------------------------------ 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