Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!uunet!timbuk!shamash!hare!ddh From: ddh@hare.cdc.com (Dan Horsfall) Newsgroups: comp.lang.fortran Subject: Re: integer variable format address Message-ID: <31132@shamash.cdc.com> Date: 7 Mar 91 14:49:49 GMT References: Sender: usenet@shamash.cdc.com Reply-To: ddh@dash.udev.cdc.com (Dan Horsfall) Organization: Control Data Corp, Arden Hills, MN Lines: 49 In article maine@altair.dfrf.nasa.gov (Richard Maine) writes: [ ... previous stuff on use of assign for format identifier ... ] > > Now I'd agree that usage of assign is "poor" style. I never once > have used assign in my f77 code. As pointed out by other posters, > the preferred way of handling such issues in f77 involves character > variables as formats. However, poor style or not, the assign is > standard, should work on any standard-conforming compiler, and > does on at least the Sun compiler I just checked. > -- > Richard Maine > maine@altair.dfrf.nasa.gov I can't quite go this far with Richard. Granted, this use of assign is "infrequently" (OK, almost never) used, but that doesn't make it poor style. Given the long code sequences that some compilers generate for I/O statements, I much prefer IF( condition ) ASSIGN 901 TO IFMT ELSE ASSIGN 902 TO IFMT ENDIF WRITE( LU, IFMT ) iolist over IF( condition ) WRITE( LU, 901 ) iolist ELSE WRITE( LU, 902 ) iolist ENDIF and might venture so far as to suggest that such usage could even justify (enough disclaimers?) the standardization of this syntax. [ Don't bother flaming: I know that it _could_ be done with character variables, arrays, subscripts, or what-have-you. On the systems on which I have reviewed the generated object code, ASSIGN generally produces a and sequence, used without further massaging at WRITE time; this is almost always less code than subscripting into a character array. ] -- Horse + Control Data Corporation Dan Horsfall +1-612-482-4622 + 4201 Lexington Ave North Internet ddh@dash.udev.cdc.com + Arden Hills MN 55126 USA