Deutsch English Français Italiano |
<lnglsrFs9nrU7@mid.individual.net> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: rbowman <bowman@montana.com> Newsgroups: alt.folklore.computers,comp.os.linux.misc Subject: Re: The joy of FORTRAN Date: 19 Oct 2024 03:03:55 GMT Lines: 60 Message-ID: <lnglsrFs9nrU7@mid.individual.net> References: <vd8doi$15q07$1@dont-email.me> <vdn5nd$3ssv4$16@dont-email.me> <slrnvfu75g.t6vq.candycanearter07@candydeb.host.invalid> <kMedne0I3JBuxmL7nZ2dnZfqnPgLyJ2d@earthlink.com> <slrnvgdhcc.2nfc6.candycanearter07@candydeb.host.invalid> <ve6pfp$2p1hd$8@dont-email.me> <ve8612$33lq0$3@dont-email.me> <ve9vga$3cbkr$4@dont-email.me> <mIdOO.204988$1m96.63811@fx15.iad> <vec4l3$3q4ms$5@dont-email.me> <criOO.380449$WOde.297877@fx09.iad> <20241014080601.00007478@gmail.com> <ln5gklF755tU4@mid.individual.net> <38fb5a91-5d00-be42-4bfe-2a05232a82c1@example.net> <ln7tooFijhpU2@mid.individual.net> <vemfq7$1qobu$5@dont-email.me> <venqec$24hhj$2@dont-email.me> <1420907830.750803935.503389.peter_flass-yahoo.com@news.eternal-september.org> <veqh7f$19v5v$1@paganini.bofh.team> <20241017090224.000072ce@gmail.com> <20241017203051.3143245f5330ac675cc1c166@127.0.0.1> <WUqdndxzb5qBRoz6nZ2dnZfqnPGdnZ2d@earthlink.com> <lne6rsFh72qU1@mid.individual.net> <vessel$35pc2$1@dont-email.me> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: individual.net KXOiVt7q6FRJIY7DuAVKGgQWzrIl+WgoLZ9lYFMaYQDfveYuj/ Cancel-Lock: sha1:UMFnw/Ms8vZqHA8sfCBMU7satnI= sha256:FAa8XMfDYPDi5rYEEIhO0GB3WKicpHOvGx5c3G87ujg= User-Agent: Pan/0.149 (Bellevue; 4c157ba) Bytes: 3182 On Fri, 18 Oct 2024 05:41:41 -0000 (UTC), Lawrence D'Oliveiro wrote: > On 18 Oct 2024 04:35:09 GMT, rbowman wrote: > >> Our source tree still has vestiges of Fortran that go back more than 20 >> years and are strictly f77. >> >> recnum = 1 read(adrich,15,rec=recnum) totrec >> 15 format(i10) >> >> 100 if(recnum.gt.totrec) goto 500 >> read(adrich,105,rec=recnum+1) ch >> 105 format(1a1) > > You know that Fortran 77 introduced if-then and do-while, right? In fact the continuation of the snippet is 105 format(1a1) if(ch.ge.'A' .and. ch.le.'Z') then index = ichar(ch) - 64 else if(ch.ge.'1' .and. ch.le.'9') then index = ichar(ch) - 22 else index = 36 endif All the DO constructs are variations on DO 11 k=1,strlen STNAME(k) = ' ' 11 CONTINUE I'm not about to argue the niceties of ANSI Fortran 77 but https://web.stanford.edu/class/me200c/tutorial_77/09_loops.html while-loops The most intuitive way to write a while-loop is while (logical expr) do statements enddo or alternatively, do while (logical expr) statements enddo The program will alternate testing the condition and executing the statements in the body as long as the condition in the while statement is true. Even though this syntax is accepted by many compilers, it is not ANSI Fortran 77. The correct way is to use if and goto: label if (logical expr) then statements goto label endif