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