Return to The Concepts of Binding and Binding Times

Stack-Dynamic Storage Binding:

Stack-dynamic variables are bound to storages when execution reaches the code
to which the declaration is attached. (But, data types are statically bound.)
That is, stack-dynamic variables are allocated from the run-time stack.
e.g. A Pascal procedure consists of a declaration section and a code section.
e.g. FORTRAN 77 and FORTRAN 90 use SAVE list for stack-dynamic list.
e.g. C and C++ assume local variables are static-dynamic.
Recursive subprograms:   each call of subprogram has its own local storage.
Advantage: allows recursion; conserves storage

Disadvantage: 

public class Try
{
    public static void main(String [] arg) 
   { 
      Recursion(3); 
    }
    public static void Recursion(int n)
    {
       if(n > 0)
       {
          n--;
          Recursion(n); 
          System.out.printf("%d ", n);
        }
    }
}

//C++ program
#include <iostream.h>
void Recursion(int n)
{
 if(n > 0)
 {
 n--;
 Recursion(n);
 cout<<n<<” “;
 }
}void main()
{
 Recursion(3);
}
 

 

Go To Static Storage Binding
Go To Explicit Heap-Dynamic Storage Binding
Go To Implicit Heap-Dynamic Storage Binding