next up previous contents
Next: Circle Example Up: The Building Blocks of Previous: Lifetime of Variables   Contents

Global Storage

We have seen so far that procedures communicate with the outside world via arguments and via returned values (functions); all other variables declared are local, their scope is the body of the procedure only.

This fact has the advantage that procedures can be written without any knowledge of the program unit from which they will be called - all that is required is that the interface is known.

However, for large programs, this will lead to very long argument lists, which can be a serious drawback when programming (how about writing a routine with 10,000 arguments, and then calling it from 1,000 diferent places with different actual arguments?). It is therefore necessary to have a mechanism for global storage, that is, to have variables that are visible from different program units, without being included in the argument lists.

In F95, modules provide this extra mechanism of communication. Variables declared in a module are visible within all procedures and programs which USE that particular module.



Subsections

Adrian Sandu 2001-08-26