Deutsch   English   Français   Italiano  
<vehcis$qqko$5@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!2.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Lawrence D'Oliveiro <ldo@nz.invalid>
Newsgroups: comp.lang.fortran
Subject: Re: Is there a way in Fortran to designate an integer value as
 integer*8 ?
Date: Sun, 13 Oct 2024 21:03:25 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 28
Message-ID: <vehcis$qqko$5@dont-email.me>
References: <vdict2$339ak$1@dont-email.me> <vdir24$35104$1@dont-email.me>
	<vdk718$3bulb$1@dont-email.me> <vdl6fi$3jra3$2@dont-email.me>
	<vdlfpl$3l0f5$1@dont-email.me> <vdmbml$3p2dv$1@dont-email.me>
	<vdmrgc$3rih7$2@dont-email.me> <vegdr2$m3av$1@dont-email.me>
	<vegfhf$67ut$1@paganini.bofh.team> <vegjcv$mthi$1@dont-email.me>
	<vegoi2$6m8j$1@paganini.bofh.team>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 13 Oct 2024 23:03:25 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="bdad28333359187bd11267218b038e9c";
	logging-data="879256"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19vOc5mBBzRJA+KMqEdu2v4"
User-Agent: Pan/0.160 (Toresk; )
Cancel-Lock: sha1:49YyN4JAtTnvW8J1IZTLHOFM7Vc=
Bytes: 2236

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.)