home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.mac.programmer
- Path: sparky!uunet!snorkelwacker.mit.edu!bloom-picayune.mit.edu!athena.mit.edu!sokoloff
- From: sokoloff@athena.mit.edu (James T Sokoloff)
- Subject: Re: problem with arithmetic and longints in THINK Pascal
- Message-ID: <1992Nov6.195035.7239@athena.mit.edu>
- Sender: news@athena.mit.edu (News system)
- Nntp-Posting-Host: carbonara.mit.edu
- Organization: Massachusetts Institute of Technology
- References: <1992Nov4.212432.3443@mcs.drexel.edu> <1992Nov5.005129.29548@sbcs.sunysb.edu> <1992Nov6.173213.12016@waikato.ac.nz>
- Distribution: usa
- Date: Fri, 6 Nov 1992 19:50:35 GMT
- Lines: 22
-
- In article <1992Nov6.173213.12016@waikato.ac.nz> ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University) writes:
- >In article <1992Nov5.005129.29548@sbcs.sunysb.edu>, rhorn@csws11.ic.sunysb.edu (Robert Horn) writes:
- >>
- >> Your life will likely be easier by using:
- >> x[i] := 10000 + (i - 1)*LongInt(10000);
- > ^^^^^^^
- >> Since the 10000 is a LongInt, all aritmetic involving it should be
- >> LongInt arithmetic. (Does pascal have a suffix to denote longness,
- >> like C's 10000L?)
- >
- >Yuk! Don't use a cast! (Ignorant C programmers...) Use the Ord4 function--
- >that's what it's for:
- >
- > x[i] := 10000 + Ord4(i - 1) * 10000
- >
-
- can't this be written more optimally anyway as:
- x[i] := LongInt(10000) * i;
- dispensing entirely with the bogus subtraction?
-
- ---Jim Sokoloff
-
-