Sujet : Re: Is there a way in Fortran to designate an integer value as integer*8 ?
De : ldo (at) *nospam* nz.invalid (Lawrence D'Oliveiro)
Groupes : comp.lang.fortranDate : 13. Oct 2024, 22:03:25
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vehcis$qqko$5@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11
User-Agent : Pan/0.160 (Toresk; )
On Sun, 13 Oct 2024 17:21:38 +0200, R Daneel Olivaw wrote:
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
So much simpler nowadays:
integer, parameter :: intsize = kind(0) ! or 4 for integer*4
integer, parameter :: strmax = 40
type :: record_type
integer(kind = intsize) reckey
character(len = strmax) :: recnam, recstr, recwn
integer(kind = intsize) reccod
! and so on
end type record_type
! declare a variable of the type:
type(record_type) :: a_record
! fields accessible as “a_record % reckey”, “a_record % recname” etc
(Not actually tested, but you get the idea.)