(j3.2006) statement labels and scope

Bill Long longb
Thu Jan 14 16:40:40 EST 2016


On Jan 14, 2016, at 3:09 PM, Lionel, Steve <steve.lionel at intel.com> wrote:

> Um, what about:
> 
> subroutine sub
> 
> block
> go to 10
> 10 continue
> end block
> 
> 10 continue
> end subroutine sub


I?d argue that the text for labels would say the branch is to the continue statement inside the block.  As if the statements inside the BLOCK construct were, instead, in a contained internal procedure. 

> 
> The text for GO TO says "inclusive scope?.


Point taken.  Making the rules for labels and GOTO (the primary user of labels)  consistent would be less confusing.  (Although any code using GOTO statements is already headed down the ?confusing? path.)

The advantage of the current wording for labels is that you can insert statement labels inside a block without having to look at the code in the surrounding scope to search for label conflicts.  Only if you want to branch to a statement outside the block construct would you have to be careful to not use that label on a statement inside the block as well. 

The main question is whether the text in 3.2.5p2 needs a change, and if it does, is an incompatibility notice also needed?

Cheers,
Bill


> 
> Steve
> _______________________________________________
> J3 mailing list
> J3 at mailman.j3-fortran.org
> http://mailman.j3-fortran.org/mailman/listinfo/j3

Bill Long                                                                       longb at cray.com
Fortran Technical Support  &                                  voice:  651-605-9024
Bioinformatics Software Development                     fax:  651-605-9142
Cray Inc./ Cray Plaza, Suite 210/ 380 Jackson St./ St. Paul, MN 55101





More information about the J3 mailing list