Re: Substring in DATA implied-do




"Dick Hendrickson" <dick.hendrickson@xxxxxxx> wrote in message
news:rwsAh.37363$2m6.33903@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
John Harper wrote:
I think both the f95 and f2003 standards forbid a program beginning thus:

CHARACTER string*1025
INTEGER i
DATA (string(i:i),i=1,1025)/1025*'?'/

but allow one to begin thus:

TYPE longstr
CHARACTER string*1025
END TYPE longstr
TYPE(longstr)::example
INTEGER i
DATA (example%string(i:i),i=1,1025)/1025*'?'/

because f95 section 5.2.10 R536 and f2003 section 5.2.5 R528 both say
data-i-do-object is array-element
or scalar-structure-component
or data-implied-do

Three f95 compilers (NAG, Sun, g95) agree with me, but was there a good
reason for J3 to allow a substring in a data-implied-do only if it's a
structure component?
Interesting that the compilers agree with you. The F2003 standard has
a constraint
"C560 (R528) The scalar-structure-component shall contain at least one
part-ref that contains a subscript-list."

I'd have to look more, but I'd think that makes your last example
wrong, since there's no subscript list. When you tried this, did
you have all of the non-standard warnings enabled?
This looks like something lifted directly from the standard. What do the
C560 and the R528 refer to? LS


.



Relevant Pages

  • Re: Substring in DATA implied-do
    ... CHARACTER string*1025 ... END TYPE longstr ... reason for J3 to allow a substring in a data-implied-do only if it's a structure component? ... "C560 The scalar-structure-component shall contain at least one ...
    (comp.lang.fortran)
  • Re: Substring in DATA implied-do
    ... Three f95 compilers (NAG, Sun, g95) agree with me, but was there a good ... reason for J3 to allow a substring in a data-implied-do only if it's a structure component? ... "C560 The scalar-structure-component shall contain at least one ...
    (comp.lang.fortran)