Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!ut-sally!ut-emx!chpf127 From: chpf127@ut-emx.UUCP (J. Eaton) Newsgroups: comp.lang.fortran Subject: Re: fortran problem Summary: write correct programs Message-ID: <3386@ut-emx.UUCP> Date: 16 Jun 88 20:15:13 GMT References: <50500056@uxe.cso.uiuc.edu> Organization: The University of Texas at Austin, Austin, Texas Lines: 40 In article <50500056@uxe.cso.uiuc.edu>, hirchert@uxe.cso.uiuc.edu writes: > > I'd like to make a few more observations on the issue of changing constants > in Fortran: [ stuff deleted about changing constants ] > 3. In turn, this means that it is not necessarily "wrong" to allow programs > to commit this error. It depends on whether it is more important to you > (and your customers) to detect (or protect the program from) errors or to > achieve maximum performance on correct programs. (Of course, if you're > really generous, you can give your customers a choice, just as is usually > done for subscript bounds checking.) How about just writing correct programs from the start, or if you are unsure about what variables in the argument list may be modified, don't use constants -- use a temporary variable instead and avoid this whole problem. This can also make your code easier to read. Consider the following: CALL SUB ( X, 5, 3, 2, IER ) Who can possibly tell, without looking at SUB, what 5, 3, and 2 mean? Isn't it better to write: LDX = 5 NROW = 3 NCOL = 2 CALL SUB ( X, LDX, NROW, NCOL, IER ) I think this is a lot better. Anyone else? > Kurt W. Hirchert hirchert@ncsa.uiuc.edu > National Center for Supercomputing Applications J. Eaton UT Austin Dept of Chemical Engineering Still not speaking for my employer, even if he does pay me.