From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-0.9 required=3.0 tests=BAYES_00, PP_MIME_FAKE_ASCII_TEXT autolearn=no autolearn_force=no version=3.4.5-pre1 Path: eternal-september.org!reader02.eternal-september.org!gandalf.srv.welterde.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED.rrsoftware.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Record initialisation question Date: Mon, 18 Jan 2021 23:50:54 -0600 Organization: JSA Research & Innovation Message-ID: References: <5ff9779d$0$24281$426a74cc@news.free.fr> <60046de5$0$16169$426a74cc@news.free.fr> <709708e9-4964-40a8-b14f-d8bcc0fa5e52n@googlegroups.com> <6005e946$0$13558$426a74cc@news.free.fr> Injection-Date: Tue, 19 Jan 2021 05:50:55 -0000 (UTC) Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226"; logging-data="10147"; mail-complaints-to="news@jacob-sparre.dk" X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246 Xref: reader02.eternal-september.org comp.lang.ada:61171 List-Id: "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.