comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Record initialisation question
Date: Mon, 18 Jan 2021 23:50:54 -0600	[thread overview]
Message-ID: <ru5rvv$9t3$1@franka.jacob-sparre.dk> (raw)
In-Reply-To: 6005e946$0$13558$426a74cc@news.free.fr

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1358 bytes --]

"DrPi" <314@drpi.fr> wrote in message 
news:6005e946$0$13558$426a74cc@news.free.fr...
> Le 18/01/2021 à 00:55, Shark8 a écrit :
>> On Sunday, January 17, 2021 at 10:03:34 AM UTC-7, DrPi wrote:
>>>
>>> I had a very bad surprise : Enums are used in some records. One enum did
>>> not have the Size specified (8 bits). All was working as if it was not
>>> present except I had to assign it a value. I had to lower the
>>> Object_Size and the enum was removed from the result (its value was not
>>> present in memory mapping). After setting Size => 8 to this enum, all
>>> went well.
>>
>> This is not too bad a restriction; simply have two 
>> identical-except-for-size types.
>> NEEDED_SIZE : Constant := 2;
>> Type Base_Enumeration is (a,b,c); -- Uses defaults.
>> Type Boot_Enumeration is new Base_Enumeration with Size => NEEDED_SIZE;
>>
> That's a clever construct. I have to remember it.
> In my case I don't need 2 types since the only place the enum is used is 
> in the record which describes the memory mapping.
>
> The bad surprise is that the enum is completely discarded from the memory 
> mapping when its size is not specified.

That sounds like a bug, I don't think data is supposed to be ignored because 
of a too-small Size clause (instead, the program ought to be rejected).

                            Randy.


  reply	other threads:[~2021-01-19  5:50 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-09  9:30 Record initialisation question DrPi
2021-01-09 10:46 ` Dmitry A. Kazakov
2021-01-10 16:41   ` DrPi
2021-01-11 21:48     ` Shark8
2021-01-12 11:38       ` Simon Wright
2021-01-12 15:01         ` Shark8
2021-01-14 21:32           ` Simon Wright
2021-01-14 23:12             ` Shark8
2021-01-14 12:58       ` DrPi
2021-01-17 17:03   ` DrPi
2021-01-17 23:55     ` Shark8
2021-01-18 20:02       ` DrPi
2021-01-19  5:50         ` Randy Brukardt [this message]
2021-01-09 15:44 ` Niklas Holsti
2021-01-10 16:53   ` DrPi
2021-01-10 19:30     ` Niklas Holsti
2021-01-10 21:27       ` DrPi
2021-01-10 22:14         ` Niklas Holsti
2021-01-11 17:46           ` DrPi
2021-01-11 20:58             ` Niklas Holsti
2021-01-14 13:07               ` DrPi
2021-01-14 13:36                 ` AdaMagica
2021-01-14 14:07                 ` Jeffrey R. Carter
2021-01-14 14:09                   ` Jeffrey R. Carter
2021-01-14 14:27                 ` Niklas Holsti
2021-01-14 16:53                   ` Shark8
2021-01-15  7:50                     ` DrPi
2021-01-15 18:15                       ` Shark8
2021-01-16 10:28                         ` DrPi
2021-01-14 16:59                   ` Paul Rubin
2021-01-15  7:49                   ` DrPi
2021-01-17 17:08 ` DrPi
replies disabled

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