Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!mstan!amull From: amull@Morgan.COM (Andrew P. Mullhaupt) Newsgroups: comp.lang.c Subject: Re: Re^2: Oh noooooo!! Summary: FORTRAN doesn't allow? (I wish ! ) Message-ID: <398@s5.Morgan.COM> Date: 27 Sep 89 04:46:12 GMT References: <1098@cernvax.UUCP> <14052@lanl.gov> Organization: Morgan Stanley & Co. NY, NY Lines: 53 In article <14052@lanl.gov>, jlg@lanl.gov (Jim Giles) writes: > > The problem here is that C allows GOTOs in all the same contexts > that Fortran does. More importantly, C allows GOTOs that even > Fortran doesn't. For example: > > C Fortran > > if (a ... ... > lab1: ... 10 CONTINUE > ... ... > } ENDIF > ... ... > goto lab1 GOTO 10 > > This jump is allowed by C but not by Fortran. In fact, even the > So, the optimizer for C _cannot_ be any simpler than that for > Fortran. If you have Sun's f77 "fortran" compiler, or any other BSD "fortran" monstrosity, do not expect to have the preceding construct outlawed. F77 forbids it, but f77 on Suns will compile and run the following "outflawed" program: END DO IF (I.LT.100000) GOTO 2 DO 1 I = 3, 10 2 WRITE(*,*) I 1 CONTINUE STOP END with the output 0, 1, 2, ... 10. Now you can twiddle with the useless "-ansi" switch on the compiler all you want. I believe that the last few postings in this thread are essentially correct: FORTRAN is a more optimizable language than C. However, almost all UNIX based f77 implementations use the same intermediate language as the C compiler, and the identical code generation. I believe that this economy measure may have introduced limitations on the optimization of the FORTRAN, and perhaps even on some aspects of the F77 standard flow of control conformance, but the main point is that FORTRAN is simpler than C to optimize, but "fortran" may not be. Flaming replies that comp.lang.c is not the right group for this post will be ignored on the grounds that this post is about the detrimental side effect of the C language in the UNIX environment. All other flaming replies will be cheerfully extinguished... Later, Andrew Mullhaupt Disclaimer: Morgan Stanley bears no responsibility for any opinions expressed in this posting.