fpt and WinFPT Reference Manual - Command-line Commands

| SimCon Home | Ref Manual Home |

FIX THE LENGTH OF ARRAY CHARACTER PARAMETERS

Syntax:

[DO NOT] FIX [THE] LENGTH [OF] ARRAY CHARACTER PARAMETERS [DO NOT] FIX [THE] LENGTHS [OF] ARRAY CHARACTER PARAMETERS [DO NOT] FIX [THE] LENGTH [OF] CHARACTER ARRAY PARAMETERS [DO NOT] FIX [THE] LENGTHS [OF] CHARACTER ARRAY PARAMETERS

Function:

Parameters of type CHARACTER may be declared with wild-card lengths and the length is then taken to be the length of the specified character constant. If the character parameter is an array, the specified character constants are required by the Fortran Standard to be of the same length. However, several compilers, in particular ifort, CVF and VMS, do not enforce this restriction. A parameter may then be declared, e.g.

CHARACTER*(*),PARAMETER :: pnum(4) = & ['one','two','three','four']

These compilers then take the length to be the longest of the character constants in the list.

This command instructs fpt to specify the length explicitly so that the code becomes portable. The above code is modified to:

CHARACTER*5,PARAMETER :: pnum(4) = & !------------------^--------------------------------------------------- !!! FPT - 4151 CHARACTER size specified explicitly for array PARAMETER !---------------------------------------------------------------------- ['one','two','three','four']

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