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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,1d27f1e3f05269e X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!club-internet.fr!feedme-small.clubint.net!nuzba.szn.dk!news.jacob-sparre.dk!pnx.dk!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: pragma Convention questions Date: Wed, 14 Nov 2007 23:06:37 -0600 Organization: Jacob's private Usenet server Message-ID: References: <87sl3cd9cw.fsf@willow.rfc1149.net> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: jacob-sparre.dk 1195102992 14454 69.95.181.76 (15 Nov 2007 05:03:12 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Thu, 15 Nov 2007 05:03:12 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1914 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1914 Xref: g2news1.google.com comp.lang.ada:18403 Date: 2007-11-14T23:06:37-06:00 List-Id: "Samuel Tardieu" wrote in message news:87sl3cd9cw.fsf@willow.rfc1149.net... > I have several questions regarding pragma Convention in Ada95 for > language lawyers. > > 1- pragma Convention on private types in language-define packages > > Is it allowed for a compiler implementor to use a pragma Convention > on a private type in a language-defined package? I would say that is not allowed, because it could cause portability problems between implementations. But I don't have any RM reference for that opinion, so if you really care you'll need to ask on Ada-Comment. Also: > For example, would it be allowed to use > > pragma Convention (C, chars_ptr); > > in the private part of Interfaces.C.Strings? (the real motive to this > question is to get rid of a warning in GNAT about conversion between > pointers of different conventions -- the type is already compatible > with C as per RM B3.1(1)) I think in this case, you could never tell the difference, so it would be OK to do. (One wonders why the Standard didn't include that in the first place.) > 2- pragma Convention, renaming and Intrinsic > > Is the following code legal? > > package U is > type Foo is (Foo1, Foo2); > function F return Foo renames Foo1; > pragma Convention (Ada, F); > type Foo_Access is access function return Foo; > X : Foo_Access := F'Access; > end U; > > GNAT rejects X initialization with 'prefix of "Access" attribute > cannot be intrinsic'. Which means that the pragma Convention failed > silently. Is it allowed to have it fail without a compilation error? > Or is the 'Access legal? I think that it should either work or the pragma Convention should be rejected. To allow the change of the convention to one that is legal and still reject the 'Access is bogus. (OTOH, this doesn't seem like a very important bug, and I would not be surprised if it took a long time to get fixed.) Randy.