Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP Fortran 90 Programmer's Reference: HP Fortran 90 Programmer's Reference > Chapter 10 HP Fortran 90 statements

PUBLIC (statement and attribute)

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Glossary

Enables access to module entities by use association.

Syntax

The syntax of a type declaration statement with the PUBLIC attribute is:

type, attrib-list :: access-id-list
type

is a valid type specification (INTEGER, REAL, LOGICAL, CHARACTER, TYPE ( name), etc.).

attrib-list

is a comma-separated list of attributes including PUBLIC and optionally those attributes compatible with it, namely:

ALLOCATABLE

INTRINSIC

SAVE

DIMENSION

PARAMETER

TARGET

EXTERNAL

POINTER

VOLATILE

access-id-list

is a comma-separated list of one or more of the following:

  • constant-name

  • variable-name

  • procedure-name

  • defined-type-name

  • namelist-group-name

  • OPERATOR ( operator )

  • ASSIGNMENT ( = )

The syntax of the PUBLIC statement is:

PUBLIC [[::] access-id-list]

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:

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© Hewlett-Packard Development Company, L.P.