Path: utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!unix.cis.pitt.edu!dsinc!netnews.upenn.edu!saul.cis.upenn.edu!hodas From: hodas@saul.cis.upenn.edu (Josh Hodas) Newsgroups: comp.sys.mac.programmer Subject: Re: Pascal deficiency? Message-ID: <34996@netnews.upenn.edu> Date: 18 Dec 90 15:12:18 GMT References: <13650001@hpspdra.HP.COM> <1990Dec18.042748.6765@d.cs.okstate.edu> Sender: news@netnews.upenn.edu Reply-To: hodas@saul.cis.upenn.edu (Josh Hodas) Organization: University of Pennsylvania Lines: 68 In article <1990Dec18.042748.6765@d.cs.okstate.edu> minich@d.cs.okstate.edu (Robert Minich) writes: >by stevewi@hpspdra.HP.COM (Steve Witten): >| You can use the 'succ' and 'pred' operators/functions in Pascal to >| accomplish the same function as '++' and '--'. So: >| >| integer i,j,k; >| >| ... >| >| j := succ(i); { same as 'j=i++' } >| k := pred(i); { same as 'k=i--' } >| >| ... >| >| However, you have to remember that '++/--' are positional as well. >| You cannot recreate this behavior. You also cannot recreate the >| behavior of 'x++' without an assignment in Pascal. > > Do you not use C very often or are you VERY tired? The above Pascal >statements are equivalent to > > j := i + 1; > k := i - 1; > >whereas the C translates to Pascal as > >j = i++; | j := j + i; > | i := i + 1; >k = i--; | k := i - 1; > | i := i - 1; > Robert, Do you not use C very often or are you VERY tired? Sorry, I couldn't resist. j = i++ => j := i; i := i + 1; K = i-- => K := i; i := i - 1; and, for completeness: j = ++i => i := i + 1; j := i; K = i-- => i := i - 1; k := i; Josh ---------------------------------------------------------------------------- Josh Hodas Home Phone: (215) 222-7112 4223 Pine Street School Office Phone: (215) 898-9514 Philadelphia, PA 19104 New E-Mail Address: hodas@saul.cis.upenn.edu