fpt and WinFPT Reference Manual - Command-line Commands

| SimCon Home | Ref Manual Home |

OPTIONAL

Syntax:

!% OPTIONAL [:] [:] { <symbol> | <string> }...

Function:

Specifies that the named sub-program argument(s) are optional. fpt uses this information in the argument consistency check (please see CHECK ARGUMENTS). No error or warning is generated if the optional argument is omitted when the routine is called.

Note that in modern Fortran an argument may be declared to be optional. However some extended FORTRAN 77 systems remain in use and do not support the Fortran keyword OPTIONAL. fpt is sometimes used to prepare code for them and optional arguments may be identified by this command.

Names which contain exotic characters such as '%', ':' or '#' (which are all legal on some systems) must be written as quoted strings.

The %OPTIONAL command must be written in code within the scope of declaration of the variables.

Where to Use this Command

Operating system command line No
Configuration file, config.fsp No
Specification (fsp) files, *.fsp No
Interactively, to FPT> prompt No
Interactive command files No
Embedded in the Fortran code Yes

Default

Not optional.

Examples

SUBROUTINE FILE_OPEN(LUN,FNAME,HEADER) INTEGER*4 LUN ! Unit to open CHARACTER*(*) FNAME ! File name CHARACTER*(*) HEADER ! Header at start of file !% OPTIONAL :: HEADER

See Also

CHECK ARGUMENTS

Copyright ©1995 to 2025 Software Validation Ltd. All rights reserved.