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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: What exactly is the licensing situation with GNAT? Date: Fri, 14 Nov 2014 09:36:10 +0100 Organization: cbb software GmbH Message-ID: References: <35f01472-3510-4f67-8765-006fa8591c35@googlegroups.com> <9tc8w.73007$ZT5.37595@fx07.iad> <22a3816a-4e89-48f0-a126-dce581781beb@googlegroups.com> <084b1934-9641-425e-85ec-293e0334413e@googlegroups.com> <86bf69c8-eb08-4696-b6c9-3784f5c42213@googlegroups.com> <87389olqie.fsf@ixod.org> <19fa65d4-72c9-44ab-b44b-4ea0929c18f2@googlegroups.com> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: p9a8jKAGz0rpkSSbWxF1gQ.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Xref: news.eternal-september.org comp.lang.ada:23272 Date: 2014-11-14T09:36:10+01:00 List-Id: On Thu, 13 Nov 2014 15:51:54 -0600, Randy Brukardt wrote: > I recall Adam suggesting that some special sort of named > access-to-subprogram type be defined with similar characteristics to the > anonymous access-to-subprogram. Such a thing could be made to work, while > the bare pointer used for normal access-to-subprogram types would not work. > But of course it would be susceptible to dangling pointers, and won't > (usually) be compatible with C. I was always wondering why it was not a plain subprogram type. That would solve a lot of problem, interfacing C included. E.g. type procedure Callback; pragma Convention (C, Callback); procedure Foo (F : Callback); pragma Import (C, Foo); procedure Bar is X : Callback := begin ... end; begin Foo (X); -- I know what I am doing end Bar; Certainly there is a danger that C would copy the pointer and use it after leaving Bar, but that is not Ada's concern. Because it is equally apply to *any* non-scalar arguments passed to C. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de