John wrote:
> This reminds me of a common practice before ENDDO where when long or complexly nested loops were used it was common to use Innn as the index where nnn matched the numeric label on the CONTINUE. Something like
>
> do i10=1,13
> :
> do i20=4,10,2
> :
> 20 continue
> :
> 10 continue
This could never have worked unless it was some compiler extension. Pre end-do era
had labeled do-loops, e.g.,
do 20 i20 =1, 13
do 10 i10 =1, 13
...
10 continue
20 continue
Granted, encoding the statement label into the do index makes sense.
> so I might like something like
> do k: 1,20,2
> :
> write(*,*)'K=',k
> enddo k:
This is almost the do-current construct, which can be something like
do concurrent (integer :: k = 1:13)
...
end do
It should be feasible to omit the 'concurrent' portion and give 'k'
local scope to the do-loop.
> which would be equivalent to
>
> block
> integer :: k
> do k=1,20,2
> :
> write(*,*)'K=',k
> enddo
> endblock
>
> where k would only have scope inside the do-loop,
That would be an incompatible change to the Fortran standard. 'k' is in the
scope of the block construct. And, if a programmer does not use 'implicit none'
and 'k' has not been previously declared and the 'integer k' declaration within
the block is omitted, then 'k' escapes to the scope of the construct that
contains the block construct.
--
steve