Print

Print


This question wasn't resolved in CLF.
Seeking clarification here.

Anton

From: Ian Harvey
Newsgroups: comp.lang.fortran
Subject: Declaration ordering restrictions for named constants
Date: Sun, 8 Nov 2015 14:50:36 +1100

When discussing initialization in a type declaration statement, F2008 
5.2.3 has a requirement that "if the variable is an array, it shall have 
its shape specified in either the type declaration statement or a 
previous attribute specification statement in the same scoping unit".

But a constant is not a variable.

So is the following conforming?

   INTEGER, PARAMETER :: a = [1, 2]
   DIMENSION a(2)
   END

There is a requirement on named constants declared in parameter 
statements to have their shape specified in a prior specification 
statement (5.4.11p2), but I cannot find a similar restriction for named 
constants declared via type declaration statements.

The compilers that I have access to sensibly assume such a restriction 
exists.  Perhaps I have missed it.