[J3] Does Note 3 on page 75 violate C762?
Steven G. Kargl
kargl at troutmask.apl.washington.edu
Tue Jun 2 21:05:28 EDT 2020
(This has been posted to comp.lang.fortran for discussion)
The document I have is
WD 1539-1, J3/18-007r1 (F2018 Interpretation document)
An example in https://stackoverflow.com/questions/62005934
has sparked debate on what the Fortran standard requires.
Does Note 3 on page 75 violate C762?
C762 (R737) If component-initialization appears, every type parameter
and array bound of the component shall be a colon or constant expression.
>From Note 3, the derived type definition is
TYPE MEMBER(NAME_LEN)
INTEGER, LEN :: NAME_LEN
CHARACTER(LEN = NAME_LEN) :: NAME = ''
INTEGER :: TEAM_NO, HANDICAP = 0
TYPE(SINGLE_SCORE), POINTER :: HISTORY => NULL ( )
END TYPE MEMBER
Is NAME_LEN considered to be a constant expression in that
a type declaration is of the form
TYPE(MEMBER(9)) LEAGUE(36)
Here, NAME_LEN has the value of 9. Should C762 be modified to
C762 (R737) If component-initialization appears, every type parameter
and array bound of the component shall be a colon, constant expression,
or a type-param-name.
Also note, that NAME_LEN will always be defined when the derived
type definition is used in a type declaration statement. This
is guaranteed by
C792 (R754) There shall be at most one type-param-spec corresponding to
each parameter of the type. If a type parameter does not have a default
value, there shall be a type-param-spec corresponding to that type
parameter.
In any event, either C762 or Note 3 needs to be modified.
--
Steve
----- End forwarded message -----
--
Steve
More information about the J3
mailing list