comp.lang.ada
 help / color / mirror / Atom feed
From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: Valid attribute and input operations
Date: Tue, 26 Sep 2023 10:22:14 +0300	[thread overview]
Message-ID: <knff56Fdjg6U1@mid.individual.net> (raw)
In-Reply-To: <uetsq8$2cgii$1@dont-email.me>

On 2023-09-26 9:13, Randy Brukardt wrote:

> ... for Janus/Ada, enumeration types with specified representations
> operate internally on the position numbers


Hm, that's interesting. Is that also the representation for record 
components of such an enumerated type?

For example, if I have:

    type Command is (Off, On) with Size => 4;
    for Command use (Off => 2, On => 5);
    type Two_Commands is record
       C1, C2: Command;
    end record
    with Pack, Size => 8;

    TwoC : Two_Commands := (C1 => On, C2 => Off);

will the record components (in memory) have the values C1 = 1 and C2 = 0 
(position numbers) or C1 = 5, C2 = 2 (specified representation)?

If they are represented by position numbers in the record, many if not 
most of my embedded Ada programs would fail if compiled with Janus/Ada, 
because the record values stored in I/O control registers or accessed 
via DMA would be wrong.

Damn, I thought those programs were not so compiler-dependent :-(

  reply	other threads:[~2023-09-26  7:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-23 20:22 Valid attribute and input operations Maciej Sobczak
2023-09-23 21:48 ` Jeffrey R.Carter
2023-09-26  6:13   ` Randy Brukardt
2023-09-26  7:22     ` Niklas Holsti [this message]
2023-09-28  3:27       ` Randy Brukardt
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox