(j3.2006) scope of implicitly declared entities in BLOCK constructs

Robert Corbett Robert.Corbett
Fri Mar 6 20:06:38 EST 2009


Van Snyder wrote:
> On Fri, 2009-03-06 at 02:51 -0800, Robert Corbett wrote:
> 
>>As the draft Fortran 2008 standard is currently written,
>>a data entity that is implicity declared in a BLOCK
>>construct has the scope of the outermost scoping unit
> 
>   Actually innermost ------------^^^^^^^^^
              ^^^^^^^^^

Outermost.  Page 108 of J3/09-007, lines 11 and 12 states

     The data entity is treated as if it were declared in an
     explicit type declaration in the outermost scoping unit
                                      ^^^^^^^^^
     in which it appears.

Bob Corbett

>   A block is not a scoping unit.
> 
>>that contains it.  Thus,
>>
>>       PROGRAM MAIN
>>         BLOCK
>>           I = 10
>>         END BLOCK
>>         PRINT *, I
>>       END
>>
>>conforms to the draft standard, but
>>
>>       PROGRAM MAIN
>>         BLOCK
>>           INTEGER I
>>           I = 10
>>         END BLOCK
>>         PRINT *, I
>>       END
>>
>>does not.  Is that the intent of the committee?
> 
> 
> This was precisely the intent.
> 
> This program also conforms:
> 
>   program main
>     block
>       i=10
>     end block
>     block
>       print *, i
>     end block
>   end program
> 
> 
>>Bob Corbett
>>
>>_______________________________________________
>>J3 mailing list
>>J3 at j3-fortran.org
>>http://j3-fortran.org/mailman/listinfo/j3
> 
> 
> _______________________________________________
> J3 mailing list
> J3 at j3-fortran.org
> http://j3-fortran.org/mailman/listinfo/j3




More information about the J3 mailing list