Fortran

Guide To Learn

Some restrictions on pure procedures

A pure procedure, while advantageous from both program design and compiler optimization perspectives, does come with a number of restrictions:

  • If it’s a function, it can’t alter its input arguments. This implies that all dummy arguments must be declared with the intent(in) attribute.
  • It can read global variables (for the main program or module), but it can’t alter them.
  • It can invoke only pure procedures.
  • It can’t contain the stop statement–this would stop the execution of the whole program, and is thus a side effect.

There are several more restrictions on pure procedures that are more situational and that you’re less likely to encounter. We’ll revisit this topic later in the book as we encounter these edge cases.

Some restrictions on pure procedures

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top