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?
-- John Harper, School of Mathematics, Statistics and Computer Science,
Victoria University, PO Box 600, Wellington 6140, New Zealand
e-mail john....@vuw.ac.nz phone (+64)(4)463 5341 fax (+64)(4)463 5045
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?
Dick Hendrickson
> John Harper wrote:
(snip)
>> 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."
(snip)
So:
CHARACTER*1025 string(1)
INTEGER i
DATA (string(1)(i:i),i=1,1025)/1025*'?'/
should also work?
How about
CHARACTER*1025 string=repeat('?',1025)
-- glen
That constraint isn't in f95, so the second example would seem to be
good f95 but bad f2003.
>When you tried this,
>did you have all of the non-standard warnings enabled?
I compiled each twice. Once with no options set and once with these:
with g95: -std=f95 -v -freal=nan -finteger=-1234567890 -fbounds-check
with Sun: -ansi -V -C -w4 -ftrap=%all,no%inexact,no%underflow -g
with NAG: -nan -gline -C=all -f77 -version
Same results both ways. All those f95 compilers have implemented some
f2003 features, but C560 can't be among them.
> >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.
>
> That constraint isn't in f95, so the second example would seem to be
> good f95 but bad f2003.
That would be surprising and presumably unintentional if true, since it
isn't listed as an incompatibility. Have you checked the f95 corrigenda?
--
Richard Maine | Good judgement comes from experience;
email: last name at domain . net | experience comes from bad judgement.
domain: summertriangle | -- Mark Twain
> "Dick Hendrickson" <dick.hen...@att.net> wrote in message
> news:rwsAh.37363$2m6....@bgtnsc05-news.ops.worldnet.att.net...
> > The F2003 standard has a constraint
> > "C560 (R528) The scalar-structure-component shall contain at least one
> > part-ref that contains a subscript-list."
> This looks like something lifted directly from the standard.
Yes.
> What do the C560 and the R528 refer to?
C560 is the constraint number for this constraint. (It is the 60th
constraint in clause 5). The R528 is the syntax rule to which teh
constraint applies (The 28th rule of clause 5). The numbers make citing
them far simpler.
Of course, if you aren't looking at a copy of the standard, none of that
would make any sense. But then since it is a question about a fine point
of the exact wording of the standard, the whole thing wont make any
sense anyway unless you are looking at a copy of the standard.
Yes it is, it's just in a somewhat different spot and the rule
number it applies to is different, so it's harder to find.
It's the 4th constraint from the top on page 62.
Dick Hendrickson
[and claimed that the above was good f95]
>>>> Three f95 compilers (NAG, Sun, g95) agree with me
>> ...
>>> 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."
>>
>> That constraint isn't in f95, so the second example would seem to be
>> good f95 but bad f2003.
>>
>
>Yes it is, it's just in a somewhat different spot and the rule
>number it applies to is different, so it's harder to find.
>It's the 4th constraint from the top on page 62.
Apologies, and thank you! I had indeed failed to find what's there.
The program is both bad f95 and bad f2003. As the 3 compilers all
appear to violate an f95 constraint, I shall send bug reports.