Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!weyrich!orville From: orville@weyrich.UUCP (Orville R. Weyrich) Newsgroups: comp.lang.fortran Subject: Re: Where can I find a Fortran style guide? Message-ID: <1991May24.031430.1891@weyrich.UUCP> Date: 24 May 91 03:14:30 GMT References: <2167@tharr.UUCP> Reply-To: orville@weyrich.UUCP (Orville R. Weyrich) Organization: Weyrich Computer Consulting Lines: 48 In article <2167@tharr.UUCP> gombo@tharr.UUCP (Alun Jones) writes: >I've reached the stage in my conversion of a large suite of Fortran that I >feel it would be useful to inform my bosses of where I feel their program is >'badly' written. Although I don't have any syntax problems with their code, I did that once, and my boss took it as a personal attack. [He had written much of the code himself, in FORTRAN-II]. I lost my job. Hope you fare better. >there are one or two things that I feel are bad style - using too many >implicit variables, assuming variables are initialised to zero, mixing and >matching variable types in common blocks, that kind of thing. Avoiding implicit variables doesn't help style much, unless your compiler has an "IMPLICIT NONE" statement that will trap unexpected implicit variables arising due to typos. Assuming variables to be initialized to zero is definitely non-portable. What hardware platform are you using? It is non-standard to expect unitialized variables to be zero. Using COMMON to purposely overlay variables of different types is non-standard and will cause trouble porting to machines with different word sizes. The standard does permit defining different sets of variables in different (unnamed) COMMON statements, but only in the case that the intent is to overlay working storage usage by different routines [an obsolete usage that is not necessary in virtual-storage systems]. It is definitely against the rules to do this to accomplish type-conversions, etc. >Now, most compilers will quite happily accept these as valid, although I know >at least one is against ANSI standards. But I'm fairly sure they're 'bad' >style. Now, I can't really say that to my bosses without some convincing >arguments, so I'm looking for a Fortran programming style guide. I would suggest "FORTRAN Poisons and Antidotes" by Brian T. Smith, in the book "Portability of Numerical Software". It is Springer-Verlag Lecture Notes in Computer Science #57 (1977). The whole book is good reading. -------------------------------------- ****************************** Orville R. Weyrich, Jr., Ph.D. Certified Systems Professional Internet: orville%weyrich@uunet.uu.net Weyrich Computer Consulting Voice: (602) 391-0821 POB 5782, Scottsdale, AZ 85261 Fax: (602) 391-0023 (Yes! I'm available) -------------------------------------- ******************************