Sujet : Re: Is there a way in Fortran to designate an integer value as integer*8 ?
De : Danny (at) *nospam* hyperspace.vogon.gov (R Daneel Olivaw)
Groupes : comp.lang.fortranDate : 13. Oct 2024, 16:21:38
Autres entêtes
Organisation : To protect and to server
Message-ID : <vegoi2$6m8j$1@paganini.bofh.team>
References : 1 2 3 4 5 6 7 8 9 10
User-Agent : Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 SeaMonkey/2.53.18.2
Thomas Koenig wrote:
R Daneel Olivaw <Danny@hyperspace.vogon.gov> schrieb:
Equivalences are an effective way of building data structures, you can
do that with Common as well but sometimes equivalence is more suitable.
Can you give an example? I have a hard time imagining what it would
be useful for.
integer record (100), reckey, reccod
c or integer*4
character*40 recnam, recstr, rectwn
c
equivalence (record, reckey), (record (2), recnam)
equivalence (record (12), recstr), (record (22), rectwn)
equivalence (record (32), reccod)
c and so on
I have used constructs like that to handle database structures, although obviously we were restricted to whole-word fields and multiple-word fields - with everything being on word boundaries.
One Fortran implementation I used for years allowed us to use statement functions to implement partial-word fields, these functions could be used on the left or the right sides of an assignment.
That permitted far more fine tuning.