DOCERR: All Expressions Not Allowed in PARAMETER Statement (83225)
The information in this article applies to:
- Microsoft FORTRAN Compiler for MS-DOS 4.0
- Microsoft FORTRAN Compiler for MS-DOS 4.1
- Microsoft FORTRAN Compiler for MS-DOS 5.0
- Microsoft FORTRAN Compiler for MS-DOS 5.1
- Microsoft FORTRAN compiler for OS/2 4.1
- Microsoft FORTRAN compiler for OS/2 5.0
- Microsoft FORTRAN compiler for OS/2 5.1
This article was previously published under Q83225 SYMPTOMS
The "Microsoft FORTRAN Reference" for versions 5.0 and 5.1, and the
"Microsoft FORTRAN Language Reference" for versions 4.0 and 4.1,
describe the PARAMETER statement in the following manner:
PARAMETER (name=expression [[,name=expression]]...)
This implies that you can uses expressions in PARAMETER statements.
However, only a constant expression can be used.
The FORTRAN PowerStation Language Help correctly indicates that only
constant expressions may be used in the PARAMETER statement.
CAUSE
The ANSI FORTRAN Standard (X3.9-1978) describes the PARAMETER
statement as follows (Section 8.6):
PARAMETER (p=e [,p=e]...)
where: p is a symbolic name
e is a constant expression
The standard goes on to define a constant expression as an
expression made up of primitive constants (numbers or prior
PARAMETER values) and arithmetic or logical operators. This is not
the same as the definition of an expression. The FORTRAN 5.1
reference manual, page 30, describes an expression as follows:
An expression is a formula for computing a value. Expressions
consist of operands and operators. The operands can be function
references, variables, structure elements, constants, or other
expressions.
This implies that functions can be used in PARAMETER statements in
Microsoft FORTRAN. This is incorrect: Microsoft FORTRAN adheres to
the ANSI standard and permits constant expressions only in
PARAMETER statements.
| Modification Type: | Major | Last Reviewed: | 12/1/2003 |
|---|
| Keywords: | KB83225 |
|---|
|