home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / sys / apple2 / 25996 < prev    next >
Encoding:
Internet Message Format  |  1992-12-24  |  2.2 KB

  1. Path: sparky!uunet!olivea!charnel!sifon!thunder.mcrcim.mcgill.edu!sobeco!philmtl!altitude!vandry
  2. From: vandry@CAM.ORG (Phillip Vandry)
  3. Newsgroups: comp.sys.apple2
  4. Subject: Re: re-entrant programs
  5. Message-ID: <Bzs3DD.9nA@CAM.ORG>
  6. Date: 24 Dec 92 19:27:12 GMT
  7. References: <BzIxqD.9Ln@griffin.cuc.ab.ca> <behrenss.724868406@hphalle6> <Bzp9w4.LGx@griffin.cuc.ab.ca>
  8. Organization: Champlain Regional College, St-Lambert QC CANADA
  9. Lines: 36
  10.  
  11. dockery@griffin.cuc.ab.ca (Sean Dockery) writes:
  12.  
  13. >Wouldn't this be as easy as having the initialization stage of the
  14. >routine save the old values of the variables in an internal buffer or
  15. >external stack, and restores the previous values when it reaches the
  16. >end of the routine?
  17.  
  18. If you want to use an internal buffer, it wouldn't work because if your
  19. routine got called again, the buffer would contain variables from two
  20. executions up and you wouldn't want to overwrite it with stuff from one
  21. execution up.
  22.  
  23. If you're talking about saving those old values on the stack, then you've
  24. just defined a recursive, reentrant routine! It's not the best way of doing
  25. recursion, but it works, and to answer your question "Wouldn't it be as easy as
  26. having...", well, yes, it would be that easy. :)
  27.  
  28. >I have previously implemented this inside some of my programs.  Oh,
  29. >well.  I guess it was bound to happen.  (Never mind: it's an inside
  30. >joke going around my programming group about me re-inventing the
  31. >wheel.)
  32.  
  33. That's good. That means you're at least as smart as the pioneers of computing
  34. who invented it first :)
  35.  
  36. >sean
  37. >-- 
  38. ># internet: dockery@griffin.cuc.ab.ca   | "alone.  death can't hold a candle
  39. >#      -or- dockery@pro-calgary.cts.com |  to it, and hell is a poor synonym"
  40. ># pro-line: dockery@pro-calgary         |                       -stephen king
  41. >#     uucp: crash!pro-calgary!dockery   | disclaimer: i am unemployed
  42.  ______________________________________________________________________
  43. |~~~~~~~~~~~~~~~~|~~~~~~~~~~~~~~~~|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
  44. | Phillip Vandry | Vandry@Cam.Org | Merry Christmas II you!            |
  45. |________________|________________|____________________________________|
  46.  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  47.