a_dent@vaxa.uwa.oz (Andy Dent, ph: 09 380 2620) (06/26/89)
A question came up recently whilst using THINK Pascal (LSP v2.01) to create a pure CODE resource (for a Quickmail bridge). Namely, what is the exact persistence of local variables in the "main" procedure? In this environment (as for most CODE resources) there is no main program but rather a procedure or function that fulfills a similar purpose and which lexically encloses the definitions of all other procedures. Whilst THINK Pascal does some fancy shuffling to give you "global" variables for Desk Accessories and other types of CODE resources, it fails to do so for "pure" CODE resources. I have seen evidence that the local variables of the "main" procedure do retain their values (between calls to the procedure) but I'm not sure if this is guaranteed. Possibly, the only governing factor is the set of attributes given to the resource (eg: not-purgeable,locked) but I have a suspicion that different types of variables may vary in their behaviour. Any comments?
siegel@endor.harvard.edu (Rich Siegel) (06/28/89)
In article <384@vaxa.uwa.oz> a_dent@vaxa.uwa.oz (Andy Dent, ph: 09 380 2620) writes: >A question came up recently whilst using THINK Pascal (LSP v2.01) to create >a pure CODE resource (for a Quickmail bridge). Namely, what is the exact >persistence of local variables in the "main" procedure? > >I have seen evidence that the local variables of the "main" procedure do >retain their values (between calls to the procedure) but I'm not sure if this >is guaranteed. Persistence of "main"'s local variables is definitely not guaranteed, since these variables are allocated on the stack, just like any other procedure's variables. This behavior depends only on what happens between calls to the code resource, since if a different sequence of subroutine call/return pairs occurs, the stack pointer might be different for different calls to the code resource. --R. ~~~~~~~~~~~~~~~ Rich Siegel Staff Software Developer Symantec Corporation, Language Products Group Internet: siegel@endor.harvard.edu UUCP: ..harvard!endor!siegel I classify myself as a real developer because my desk is hip-deep in assembly-language listings and I spend more than 50% of my time in TMON. ~~~~~~~~~~~~~~~