For Programmers: Free Programming Magazines  


Home > Archive > Fortran > October 2006 > Does the value inside DO loop still accessible when control jumps









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Does the value inside DO loop still accessible when control jumps
Shawn

2006-10-30, 7:16 pm

Hi,

I am new to Fortran. I am wondering in the code below, if GOTO 106 is
executed, then the value of I in line 106 is the last value in the DO
loop, correct? Thank you very much.

DO I = 2, 11
IF (COVER .LT. ADC(I)) GOTO 106
ENDDO
WEAI = 1.0
GOTO 105
106 J = I - 1
FJ = J - 1

For some languages, ex Java, since I is local inside the loop, if jump
out of it(by means of throw an Exception, say), the value of I is lost.
Tim Prince

2006-10-30, 7:16 pm

Michael Metcalf wrote:
> "glen herrmannsfeldt" <gah@seniti.ugcs.caltech.edu> wrote in message
> news:ehtsup$s20$1@naig.caltech.edu...
>
>
>
> ... and, if the loop completes, it has the value 12 (something to be careful
> of).
>
> Regards,
>
> Mike Metcalf
>
>

This came in the f77 standard, and was one of the last f77 standard
features to be generally accepted. I last used a compiler which didn't
implement this in 1985, so it would be only fairly old code which made a
different assumption. IIRC, in 1991 I used a compiler which had a
command line option to adhere to this standard or not. I still work
with people who don't trust any Fortran syntax which hasn't held steady
for 20 years.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com