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!news4.google.com!proxad.net!feeder1-2.proxad.net!cleanfeed3-a.proxad.net!nnrp7-2.free.fr!not-for-mail From: Samuel Tardieu Newsgroups: comp.lang.ada Subject: Re: pragma Convention questions References: <87sl3cd9cw.fsf@willow.rfc1149.net> <2451589.tWPigV6bxQ@linux1.krischik.com> Date: Sun, 11 Nov 2007 21:57:25 +0100 Message-ID: <87mytkcxfu.fsf@willow.rfc1149.net> User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) Cancel-Lock: sha1:xUZKH3C6o+FsDY7+xNbNVN43EFY= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Leafnode-NNTP-Posting-Host: 2001:6f8:37a:2::2 Organization: Guest of ProXad - France NNTP-Posting-Date: 11 Nov 2007 22:00:08 MET NNTP-Posting-Host: 88.191.14.223 X-Trace: 1194814808 news-3.free.fr 10874 88.191.14.223:46074 X-Complaints-To: abuse@proxad.net Xref: g2news1.google.com comp.lang.ada:18288 Date: 2007-11-11T22:00:08+01:00 List-Id: >>>>> "Martin" == Martin Krischik writes: Martin> Yes. However the type must not be used beforehand - which is Martin> unlikely. Real language lawyers can tell you the term after Martin> which a type can not have any further modifications. Thank you, I know the freezing rules and they would not be violated. My question was related to the legality of doing that when I could not find the RM section which allows you to change the default convention (Ada) of language-defined types (Interfaces.C.Strings.chars_ptr). Martin> F does not actually exist and therefore has no address to Martin> access. And for "Convention Ada" that's ok. What you really Martin> meant to do is: Martin> pragma Export (Ada, F); I don't think so, pragma Convention should be enough. Note that renaming an existing function instead of an enumeration literal doesn't exhibit the same behaviour. Martin> But somehow I think that will fail because F does exists Martin> physically. It doesn't exist physically because it inherits the convention of the renamed entity (the enumeration literal, which has an Intrinsic convention). That's precisely why I don't understand why GNAT lets me specify its convention if it isn't able to honor it. Note that the fact that an enumeration literal doesn't exist physically as a function doesn't prevent you from using it as a generic actual subprogram: package W is generic with function F return Boolean; package Gen is end Gen; package Inst is new Gen (False); end W; (however, legality rules prevent you from ever taking a 'Access from inside the generic as formal subprograms are not subtype conformant with anything else, so my question would be void in this case) The more I think about it the more I think GNAT should refuse the pragma Convention, just as it refuses it if you try to apply it directly to an enumeration literal. That's why I'd like some advice here. I'll ask ada-comment, I hadn't thought about it, thanks. Martin> I take it you know C Yup, but there is no need to resort to an inferior language :) Sam -- Samuel Tardieu -- sam@rfc1149.net -- http://www.rfc1149.net/