home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / pascal / 7679 < prev    next >
Encoding:
Internet Message Format  |  1992-12-25  |  2.0 KB

  1. Path: sparky!uunet!haven.umd.edu!mimsy!nocusuhs!nmrdc1!frmug!lill!vanney.raphael
  2. From: vanney.raphael@lill.frmug.fr.mugnet.org (Vanney Raphael)
  3. Newsgroups: comp.lang.pascal
  4. Subject: TURBO PASCAL 6.0 QUESTION
  5. Message-ID: <1021.6.uupcb@lill.frmug.fr.mugnet.org>
  6. Date: 23 Dec 92 00:28:00 GMT
  7. Reply-To: vanney.raphael@lill.frmug.fr.mugnet.org (Vanney Raphael)
  8. Organization: Li'LL BBS - Paris, France
  9. Lines: 54
  10.  
  11. FS>Sorry if this a FAQ, I am currently looking at some turbo pascal 6.0
  12. FS>code that someone else has written and I am running into a problem
  13. FS>with segment sizes. The problem is as follows, this program (actually
  14. FS>a suite of programs) has a lot of explicitly declared variables and
  15. arrays
  16. FS>and they come very close to the 64K limit. This makes it very
  17. difficult to
  18. FS>extend any of these arrays, which is what I want to do, beyond their
  19. current
  20. FS>bounds. What I would like to know is if it is possible to go beyond
  21. this
  22. FS>limit in any way, or is this just hopeless. I know I can change these
  23. FS>variable to
  24. FS>dynamically allocated ones ( like a malloc in C), but I would rather
  25. not
  26. FS>mess with the programs too much.
  27.  
  28. Anyway, it seems like this is definitely your only solution ; here is a
  29. piece of hint on how to proceed :
  30.  
  31. Original (Ill-written :-)) program :
  32.  
  33. Type Tab  : Array[1..16384] Of Word ;
  34.  
  35. Var  Tab  : TTab ;
  36.  
  37. Begin
  38.      { Tab[] anywhere }
  39. End.
  40.  
  41. What you have 2 do is :
  42.  
  43. Type Tab  : Array[1..16384] Of Word ;
  44.  
  45. Var  Tab  : ^TTab ;           { Make Tab a dynamically allocated
  46. variable }
  47.  
  48. Begin
  49.      New(Tab) ;               { Don't forget to instanciate it... }
  50.      { Tab^[] anywhere }      { Replace, with your favourite editor, any
  51.                                 reference to Tab with a reference to
  52. Tab^...
  53.                                 And that's it ! }
  54.      Dispose(Tab) ;           { Cleaning-up is always worth it }
  55. End.
  56.  
  57. Hope I helped,
  58.  
  59. Alp,                                              Raphael.
  60.  
  61.  * OLX 2.1 TD * So be it...
  62. --- FMail 0.92
  63.  * Origin: ICEBERG - La Garenne * FRANCE * Tel:(33)-1-47699261 (2:320/1)
  64.                   
  65.