Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!samsung!think!ames!ncar!unmvax!brainerd From: brainerd@unmvax.unm.edu (Walt Brainerd) Newsgroups: comp.lang.fortran Subject: Re: EQUIVALENCE, COMPUTED GO TO in FORTRAN 88? Summary: OPPS, again! Message-ID: <581@unmvax.unm.edu> Date: 9 Dec 89 01:31:32 GMT References: <143@suntc.UUCP> <580@unmvax.unm.edu> Organization: University of New Mexico at Albuquerque Lines: 69 In article <580@unmvax.unm.edu>, brainerd@unmvax.unm.edu (Walt Brainerd) writes: > In article <143@suntc.UUCP>, jh34607@suntc.UUCP (john howell) writes: > > What is the status of > > > > 1) EQUIVALENCE > > 2) COMPUTED GO TO > > > > constructions in future fortrans? > > > Computed GO TO is on a list of a few noncontroversial things > with the property that they could be considered for removal > from the next standard (2001?) after the one coming up. You would think after being on X3J3 all these years, this guy would know what is in the proposed 8x (but it is a brain damaging process). The computed GO TO is not in any way indicated in 8x as possibly being removed, only the assigned GO TO. Some wrote in response to my posting that I should show what the replacements are. These can all be done syntactically; in fact I hope to have in my hands a little program that does them sometime soon. This info appears in Appendix B of the proposed 8x. 1. Arithmetic IF obviously can be replaced with logical or block IF. 2. All DO loops obviously can be rewritten, each with its own CONTINUE. 3. An alternate return can be done by passing in an additional argument, say, RETCOD, and then branching to wherever you want based on the its value using a block IF. (The 8x CASE will do it better.) 4. Who knows what PAUSE might do, but in most cases, it can be replaced by a PRINT to the standard output and a READ to cause continuation. 5. An ASSIGN and assigned GO TO can be replaced by assigning the value to an integer and then branching with a block IF based on the value. 6. Assigning a format statement label can be replaced by assigning the format specification to a character string and using the character string as the format. 7. DO loops with real and dp DO variables can be rewritten using an integer DO variables and an assignment to the replaced DO variable. Please do not assume I am claiming that all of the replacements are more efficient, or in all cases, more convenient to use. I think in almost all cases, the code will be more maintainable. (I personally don't see that using a real DO variable is any worse than putting real values in an IF statement; both may be bad practice, but only one is on the list. This could be argued for hours, of course.) (The computed GO TO could be replaced by block IFs, but not as gracefully and efficiently, but will be replaceable by the 8x CASE statement.) In the next standard after 8x, the computed GO TO may be on the "hit" list for removal from the next standard after that (Fortran 2011?), so it can be eliminated from compilers in 2033 if nobody needs it any longer. (Getting rid of it in 2022 is considered too soon by many, even though Fortran will be twice as old then as it is now!) -- Walt Brainerd Unicomp, Inc. brainerd@unmvax.cs.unm.edu 2002 Quail Run Dr. NE Albuquerque, NM 87122 505/275-0800