Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uwm.edu!cs.utexas.edu!uunet!maverick.ksu.ksu.edu!harris.cis.ksu.edu!mac From: mac@harris.cis.ksu.edu (Myron A. Calhoun) Newsgroups: comp.lang.fortran Subject: Re: Fortran 77 Style Guide (long, REPOST) Summary: Do NOT reuse FORMATs! Message-ID: <1990Sep10.141639.970@maverick.ksu.ksu.edu> Date: 10 Sep 90 14:16:39 GMT Expires: 24 September 1990 References: <26B89BE1.4349@ics.uci.edu> <59012@lanl.gov> <1794@ccadfa.adfa.oz.au> Sender: news@maverick.ksu.ksu.edu (The News Guru) Distribution: na Organization: Kansas State University, Dept. of Computing and Information Sciences Lines: 38 In article <1794@ccadfa.adfa.oz.au> you write: >>> 3) Assign a separate sequence of labels to FORMAT labels that are grouped >>> at the end of a subprogram. >>Same comment about "assign" plus the following: whenever possible, put >>the format into the I/O statement which uses it. Use labeled formats >>only when several I/O statements share the same (long) format. >I may not have been the only person to contribute this recommendation to David, >but I did contribute it so I'll defend it. If you can guarantee that every >FORMAT statement will appear immediately under (or in) the PRINT statement >that uses it, fine. As soon as you start using the same FORMAT statement in >different places, you either have to hunt through the code or locate the >FORMAT statement separately, probably at the end. I feel that it is more >consistent to have a simple rule which puts them all in one place. Unfortunately, re-used FORMATs cause programs to "break" during maintenance. The scenario is that someone modifies a FORMAT and ONE of its associated I/O statements but doesn't notice there are others. Voila! Instant "broken" program. It is EXTREMELY EASY to "guarantee that every FORMAT statement will appear immediately under (or in) the [I/O] statement that uses it". Just duplicate it. Shouldn't take more than a few keystrokes per FORMAT statement on any reasonable editor; maybe a bit more work if one is still using cards! My credentials? I routinely am called upon to modify programs written more than 20 years ago. I've learned a lot in 20 years, and one thing I've learned is to NOT reuse FORMAT statements. --Myron. -- # Myron A. Calhoun, Ph.D. E.E.; Associate Professor (913) 539-4448 home # INTERNET: mac@harris.cis.ksu.edu (129.130.10.2) 532-6350 work # UUCP: ...{rutgers, texbell}!ksuvax1!harry!mac 532-7004 fax # AT&T Mail: attmail!ksuvax1!mac