Tuesday, April 25, 2006

Common Blocks in Fortran 77

http://www.nationalfacility.apac.edu.au/training/FortranAdvanced/slides/slides.017.html

Common blocks are a Fortran 77 construct, providing areas of shared storage between different subroutines. eg.

program main
integer :: a, b
real :: c
common /d/ a, b, c
...
end program main

subroutine foo()
integer :: a, b
real :: c
common /d/ a, b, c
...
end subroutine foo
the common storage is called d and contains the integers a, b and the real c. Setting these variables in one routine changes it in all. Common blocks are now replaced by modules in Fortran 90.

No comments: