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=-1.9 required=3.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.5-pre1 X-Received: by 2002:ac8:3987:: with SMTP id v7mr5008621qte.144.1610463685713; Tue, 12 Jan 2021 07:01:25 -0800 (PST) X-Received: by 2002:a25:3891:: with SMTP id f139mr7095651yba.465.1610463685565; Tue, 12 Jan 2021 07:01:25 -0800 (PST) Path: eternal-september.org!reader02.eternal-september.org!feeder1.feed.usenet.farm!feed.usenet.farm!tr3.eu1.usenetexpress.com!feeder.usenetexpress.com!tr1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 12 Jan 2021 07:01:25 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: google-groups.googlegroups.com; posting-host=146.5.2.231; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC NNTP-Posting-Host: 146.5.2.231 References: <5ff9779d$0$24281$426a74cc@news.free.fr> <5ffb2e50$0$24253$426a74cc@news.free.fr> <2ed4c7a5-59a0-41a1-8e68-30f22bcdb5a4n@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <13d2ea86-f9a4-4015-8171-9e7c0f7c80a4n@googlegroups.com> Subject: Re: Record initialisation question From: Shark8 Injection-Date: Tue, 12 Jan 2021 15:01:25 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader02.eternal-september.org comp.lang.ada:61110 List-Id: On Tuesday, January 12, 2021 at 4:38:24 AM UTC-7, Simon Wright wrote: > Shark8 writes:=20 >=20 > >> I'll try it but I've just faced another problem where a component of= =20 > >> another record is the address of the record itself.=20 > >=20 > > Type Example;=20 > > Function To_Address( Input : Access Example ) return System.Address=20 > > with Inline;=20 > >=20 > > Type Example is limited record=20 > > Addr : System.Address :=3D To_Address(Example'Access);=20 > > End record;=20 > >=20 > > Package Cvt is new System.Address_To_Access_Conversions(Example);=20 > > Function To_Address( Input : Access Example ) return System.Address is= =20 > > ( Cvt.To_Address( Input.all'Access ) ); > OP wanted to place the data structures in ROM, the chance of this=20 > working looks pretty remote=20 Yeah, it does, if ROM's the target... but it might work. The "right way" would be to have an Address-typed parameter on the record, = defaulting with Record_Type'Address (using the same Name_in_Definition'Acce= ss trick to get the address of the component being created), but we cannot = declare discriminants which are not non-scalar or non-access. The other way= to do this might be a bit-vector sized as an address, then using Unchecked= conversion as the default value. > (what is it with this weird casing "convention" you use? makes the code= =20 > quite hard to read ...) Really? How so?