From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 2002:a05:620a:1472:: with SMTP id j18mr5146165qkl.184.1576098738371; Wed, 11 Dec 2019 13:12:18 -0800 (PST) X-Received: by 2002:a9d:eee:: with SMTP id 101mr4076187otj.5.1576098738070; Wed, 11 Dec 2019 13:12:18 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!news.gegeweb.eu!gegeweb.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!g89no5109359qtd.0!news-out.google.com!w29ni1032qtc.0!nntp.google.com!g89no5109356qtd.0!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 11 Dec 2019 13:12:17 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: google-groups.googlegroups.com; posting-host=2a02:c7d:3c35:b000:325a:3aff:fe0f:37a5; posting-account=L2-UcQkAAAAfd_BqbeNHs3XeM0jTXloS NNTP-Posting-Host: 2a02:c7d:3c35:b000:325a:3aff:fe0f:37a5 References: <36d45c82-2a6b-4c60-baeb-1a4aef5189c7@googlegroups.com> <69c7677b-4aec-4db2-b240-de6b69f762b9@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Is this actually possible? From: Lucretia Injection-Date: Wed, 11 Dec 2019 21:12:18 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader01.eternal-september.org comp.lang.ada:57711 Date: 2019-12-11T13:12:17-08:00 List-Id: On Wednesday, 11 December 2019 19:58:54 UTC, Dmitry A. Kazakov wrote: > On 2019-12-11 18:54, Lucretia wrote: > > On Wednesday, 11 December 2019 17:38:40 UTC, Dmitry A. Kazakov wrote: > >> On 2019-12-11 17:43, Lucretia wrote: > >> > >>> I was thinking about extensible records recently (not tagged types), and thought to try to export a tagged type to C, not C++. It compiles, but the results aren't quite right, so wondering if it's possible or not. > >>> > >>> The idea is to export an array of tagged types as a C array to either a function or a variable / struct element. i.e. > >> > >> Ada objects of tagged types have varying size and keep tag inside. Both > >> make them utterly incompatible with C. > > > > I know this, but as the compiler let it go through, I wondered if the tag would be stored elsewhere and not with the tagged type. > > Not with tagged types which have T <-> T'Class view conversions. > > > Otherwise, shouldn't the compiler complain? > > No idea. > > If you need objects that could be packed into C arrays use a variant > record with the choice discriminant having a default. But in my cases, a variant cannot be used.