HP Fortran Programmer's Reference (September 2007)

HP Fortran statements
PUBLIC (statement and attribute)
Chapter 10438
Description
The PUBLIC attribute may appear only in the specification part of a module. The default
accessibility in a module is PUBLIC; it can be reaffirmed using a PUBLIC statement without a
list. However, only one PUBLIC accessibility statement without a list is permit ted in a module.
The PUBLIC attribute in a type statement or in an accessibility statement permits access to
entities such as module variables, type definitions, functions, and named constants. USE
statements may control accessibility further.
A derived type may contain a PUBLIC attribute or an internal PUBLIC statement, if it is
defined in a module.
The PUBLIC statement may also be used to permit access to sub routines, generic specifiers,
and namelist groups.
The PUBLIC specification for a generic name, operator, or assignment does not apply to any
specific name unless the specific name is the same as the generic name.
Examples
MODULE fourier
PUBLIC ! PUBLIC unless explicitly PRIVATE
COMPLEX, PRIVATE :: fft ! fft accessible only in module
PRIVATE a, b, c ! accessible only in module
PUBLIC r, s, t ! accessible outside the module
END MODULE fourier
MODULE place
PRIVATE ! Change default accessibility to PRIVATE
INTERFACE OPERATOR (.st.)
MODULE PROCEDURE xst
END INTERFACE
! Make .st. public; everything else is private
PUBLIC OPERATOR (.st.)
LOGICAL, DIMENSION (100) :: lt
CHARACTER(20) :: name
INTEGER ix, iy
END MODULE PLACE
Related statements
PRIVATE and USE
Related concepts
For related information, see the following: