home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / sys / mac / programm / 18098 < prev    next >
Encoding:
Text File  |  1992-11-08  |  1.4 KB  |  36 lines

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