> Jean Vezina wrote:
> > I would like to know if the two following programs are
> > standard conforming
> ...
> > integer,parameter::x(3)=(/1,2,3/)
> > character(*),parameter::p='1234'
> > character*2 a,b
> > data i,j,k/x(1),x(2),x(3)/
>
> This could be argued either way. These are obviously not in the
> syntax category <scalar-constant>. An array element is a subobject.
> But, could these be considered <scalar-constant-subobjects>?
> I don't know. The syntax rules involving <scalar-xyz> are not
> explicitly specified, but are "assumed syntax rules". Do you
> interpret this name as subobjects of scalar constants (in which
> case, your example is illegal: they are subobjects an array constant),
> or as scalar subobjects of a constant (in which case your example
> is legal)? It is hard to tell the intent of the standard document here.
I disagree. I think that the standard is explicit:
1.6.3 Assumed syntax rules
In order to minimize the number of additional syntax rules and
convey appropriate constraint information, the following rules are
assumed. The letters "xyz" stand for any legal syntactic class
phrase:
xyz-list is xyz [ , xyz ] ...
xyz-name is name
scalar-xyz is xyz
Constraint: scalar-xyz shall be scalar.
This gives
scalar-constant-subobject is constant-subobject
Constraint: scalar-constant-subobject shall be scalar.
Next, we have
R702 constant-subobject is subobject
Constraint: subobject shall be a subobject designator whose parent is a constant.
and finally
R602 subobject is array-element
or array-section
or structure-component
or substring
So I think both codes are legal. Fujitsu and IBM agree, but some other
compilers do not.
John Reid.
|