??? 08/13/05 07:03 Modified: 08/13/05 07:26 Read: times |
#99326 - eh? Responding to: ???'s previous message |
Dear Mehdi,
how this be beneficial. the fact is if you have to store a value either on stack of some other means storage is required. if you define the space staticcaly You can have N number of subroutines, how many slots you will define? As the memory allocation is static, this locations will not be used efficiently as only that routine uses the sapce. Memory efficient stack machanism allocates and then recovers the space when not in use. another argument can be made it could be handled like SDCC defines a 'OSEG' a overlayable area, where it tries to allocate the temporary space but in this case nested subroutines are not possible also the reentrant subroutines yet another way is to use DMA (dynamic memory allocation) for such space , and what happens is what erik stated below. The routins to allocate and deallocate thse spaces will take there own space and data spaces plus the processing power. the type of machanism you are stating i have used in writing TSR cum ISR in DOS as these TSRs can not make any assumption about the availibity of the stack space. Abhishek |