Path: utzoo!attcan!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!usc!snorkelwacker!bloom-beacon!world!burley From: burley@world.std.com (James C Burley) Newsgroups: comp.lang.fortran Subject: Re: Fortran 77 Style Guide (long, REPOST) Message-ID: Date: 5 Aug 90 06:10:36 GMT References: <26B89BE1.4349@ics.uci.edu> <59012@lanl.gov> Sender: burley@world.std.com (James C Burley) Organization: The World Lines: 31 In-Reply-To: jlg@lanl.gov's message of 3 Aug 90 02:07:18 GMT I'm not too enamoured with the idea of encoding FORMAT strings as constants in I/O statements. Separate FORMAT statements, as ugly as they are, offer two advantages: 1) The compiler is forced to check the contents of the format for syntactic correctness, at least to parse hollerith and character data. It is not so required for an in-line format, which it need only ensure is a valid character constant. So programmer errors are more likely to be detected at compile time with a separate statement. 2) Some systems are likely to optimize a FORMAT statement by compiling it into an intermediate representation at compile time, but postpone doing anything about a constant FORMAT specifier in an I/O statement until a given execution of that I/O statement. So formatted I/O is likely to take less CPU time with separate FORMAT statements. Note that a system that translates constant FORMATs in I/O statements also must effectively check it for legitimacy, so if #2 does not apply to a given system, #1 probably doesn't also, and vice versa. Also note that I intend to make GNU Fortran check and compile FORMAT constants just like FORMAT statements, if I can, because aside from these two considerations, I think separate FORMAT statements are pretty silly anyway. Even if you want to use a FORMAT specifier for more than one statement, I'd prefer people use the more general PARAMETER mechanism to achieve that. But if your target system(s) suffers from either or both of the above ailments, then it might be best to stick with separate FORMAT statements everywhere you can. James Craig Burley, Software Craftsperson burley@world.std.com