Path: utzoo!mnetor!uunet!seismo!sundc!pitstop!sun!quintus!ok From: ok@quintus.UUCP (Richard A. O'Keefe) Newsgroups: comp.lang.fortran Subject: Re: Forced variable declaration Message-ID: <590@cresswell.quintus.UUCP> Date: 28 Jan 88 07:00:41 GMT References: <445@drilex.UUCP> <50500018@uxe.cso.uiuc.edu> Organization: Quintus Computer Systems, Mountain View, CA Lines: 32 In article <50500018@uxe.cso.uiuc.edu>, mcdonald@uxe.cso.uiuc.edu writes: > >I agree. That's why it's a good idea for FORTRAN programmers to include > >the line IMPLICIT LOGICAL (A-Z) or IMPLICIT CHARACTER (A-Z) in each main > >program and subprogram. Even better, many compilers now make an > >IMPLICIT NONE available. > > You must be kidding! Please, please, don't forget the smiley faces when > saying things like that! The greatest feature of Fortran over languages > like C or Pascal (well, C at least, Pascal has so many other stupids) is that > you don't have to declare variables. I just got bitten by this today. Fortunately, I had decided to test a certain function, and noticed that the relative error was approximately 2.0, when I had hoped for 0.0. The point of IMPLICIT NONE (which you don't *have* to use) or UNIX's "-u" flag (which you don'y *have* to use) is to tell you about this mis-spelled identifiers you hadn't thought of yet. Cross-references are fine *IF* you already suspect the problem! {Best of all are compiler which warn "FOO may be used before it is set"...} > In any > case, I and most of the real scientific programmers worry more about > typing r(7) where we meant r(8) than typing o(8) where we meant p(8). > Errors in the mind are much more difficult to find than errors of the > fingers. That's why pretty well every programming language except Fortran has records, and why VAX/VMS Fortran and Fortran 8X *do* have records. It's also why I never believe the output of any Fortran program I haven't read. Come to that, why not use Fortran PARAMETER statements to help with the r(7) -vs- r(8) problem? IMPLICIT NONE is the best thing that happened to Fortran since Ratfor.