STRUCTURE-UNION-MAP == TYPE-SEQUENCE-EQUIVALENCE??

STRUCTURE-UNION-MAP == TYPE-SEQUENCE-EQUIVALENCE??

If you wanted to replace UNIONised, MAPped STRUCTUREs with 'modern' FORTRAN what is the way to go? Define your STRUCTUREs as SEQUENCEd TYPEs and EQUIVALENCE them?

6 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

The way that the Fortran standard would encourage you is to use TRANSFER, but that's really awkward in many cases. So is EQUIVALENCE.

Steve

Steve - Intel Developer Support

Steve - my god! You have to be kidding! ;o) There is no point in the FORTRAN standard people (whoever they are!) (potentially) deprecating keywords if they aren't going to provide a flexible alternative. Our main product is based entirely on the concept of many, many structures mapped on top of each other in a common block union. I won't be rushing to replace all the COMMON, EQUIVALENCE, ENTRY, BLOCK DATA and STRUCTURE statements I support unless someone pushes me into it!

Um, the Fortran standards people did no such thing. STRUCTURE/RECORD/UNION/MAP is a DEC Fortran extension (created by us for VAX FORTRAN V4 in 1985), and has never been part of the standard. It is true that UNION-like capability is a major thing missing from the Fortran standard.

EQUIVALENCE is not deprecated in the standard, though it is frowned upon in some circles.

Steve

Steve - Intel Developer Support

Really? I didn't know that - unsurprsingly the FORTRAN standard is not my choice of bed-time reading, and I'm too young to have been exposed to 66 or 77 :).

I guess our windows version must be based on our old VAX version then. I'm sure we used to use MS PowerStation at one point - did that use STRUCTUREs etc? (Not that you'd know, necessarily...)

Most commercial compilers, including PowerStation, adopted "VAX Fortran" extensions, especially STRUCTURE/RECORD. It was a very popular feature! (Not all of them got it right, though!)

Steve

Steve - Intel Developer Support

Leave a Comment

Please sign in to add a comment. Not a member? Join today