Print

Print


On Wed, 30 Aug 2000, Walt Brainerd wrote:
> Van Snyder wrote:
> 
> > If GO TO could only go to a COME FROM, GO TO statements were labelled,
> > the label of the GO TO had to be mentioned in the label of the COME FROM,
> > and every label in a COME FROM was the label of a GO TO that mentioned
> > the COME FROM, one could reverse the control flow graph by inspection
> > (as opposed to "by grep" plus a lot of rejecting accidental similarities).
> > 
> > But, this will never happen in Fortran.
> 
> Maybe, but it can happen in F.  As you may remember reading,
> the next versions of F will allow GOTO, but only to a CONTINUE
> statement, so this satisfies the first requirement above  (well,
> COME FROM is spelled CONTINUE).

I knew about COME FROM, but I was convinced that it was one of the
many jokes about GOTO.                 
I am a bit astonished to see you pople talking about it seriously.              
How do you plan to handle different GOTOs pointing to the same
CONTINUE?

Anyway, since I mentioned GOTO jokes, here is one I met many
years ago. The program compiles and runs correctly: just
type in any number when it pauses.

Alberto Fasso'

CTHIS IS AN ILLUSTRATING EXAMPLE OF (ALMOST) STANDARD FORTRAN
CPROGRAMMING PRACTICE.
CTHE CODE SHOULD COMPILE AND RUN ERROR-FREE ON ALL STANDARD
CFORTRAN 77 COMPILERS.
      DATA GOTO 7, GOTO 1, GOTO 5 /1029.,221591.,1048576./
      GOTO (I)=MOD(NINT(GOTO 6)*NINT(GOTO 7)+NINT(GOTO 1),NINT(GOTO 5))
      GOTO 2
    1 WRITE(*,*) GOTO 8 ,' ===> ',GOTO 2 * 6 / GOTO 8
      GOTO (6) ,NINT(GOTO 8 - GOTO 10) + 1
      GOTO 9 = GOTO 9 * 2
      GOTO (6,7) ,NINT(GOTO 3)
    2 READ(*,*) GOTO 10
      GOTO 2 = 0
      GOTO 8 = -1
      GOTO 9 = 2
      GOTO 3 = GOTO 9 + GOTO 9
    4 GOTO 4 = 0
    5 GOTO 6 = GOTO (1)
      GOTO 4 = GOTO 6 ** 2 / GOTO 5 ** 2 + GOTO 4
      GOTO 3 = GOTO 3 + 1
      GOTO (5,5) ,NINT(GOTO 3 - 2)
      GOTO 3 = GOTO 3 - 3
      GOTO 8 = GOTO 8 + 1
      GOTO (1) ,NINT(GOTO 8 - GOTO 10) + 1
      GOTO (1) ,NINT(GOTO 8 - GOTO 9) + 1
    7 GOTO (4) ,INT(GOTO 4 ** 0.33333333)
      GOTO 2 = GOTO 2 + 1
      GOTO 4
    6 END
                                                                    
                                                                          
--------------------------------------------------
Alberto Fasso'
Stanford Linear Accelerator Center
Radiation Physics Dept. ms 48
2575 Sand Hill Road
Menlo Park, CA 94025   

Tel. +1 650 926 4062        Fax: +1 650 926 3569




%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%