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,ebdc5ed511896a0 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Newsgroups: comp.lang.ada Subject: Re: urgent question - generics References: <1188809249.040351.100160@r29g2000hsg.googlegroups.com> From: Markus E L Date: Mon, 03 Sep 2007 12:56:55 +0200 Message-ID: User-Agent: Some cool user agent (SCUG) Cancel-Lock: sha1:4nRgUy5PuH+8Gzb0DWuizvSALpI= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii NNTP-Posting-Host: 88.72.232.28 X-Trace: news.arcor-ip.de 1188816761 88.72.232.28 (3 Sep 2007 12:52:41 +0200) X-Complaints-To: abuse@arcor-ip.de Path: g2news2.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!62.111.101.3.MISMATCH!news.germany.com!news.unit0.net!newsfeed.arcor-ip.de!news.arcor-ip.de!not-for-mail Xref: g2news2.google.com comp.lang.ada:1731 Date: 2007-09-03T12:56:55+02:00 List-Id: 'anon AT anon DOT org (anon)' wrote: > with Ada.text_IO ; > with System ; > > procedure zzero is > > function function_0 ( func : System.Address ; Data : Float ) > return float is > > procedure tst ; > pragma Import ( Ada, tst ) ; > for tst'address use func ; > > begin -- function_0 > tst ; > return Data * 2.0 ; > end function_0 ; > > > -- ---------- -- > -- Test: Proc -- > -- ---------- -- > > procedure test is > begin -- test > Ada.Text_IO.Put_Line ( "Testing" ) ; > end test ; > > > Result : Float ; > > begin > Result := function_0 ( test'address, 0.5 ) ; > end zzero ; Wow, thanks. That clearly illustrates what I've been secretly suspecting for some time: That 'anon@anon.org', the great and only with suuuuuch a long history in Ada and whatever, has no, absolutely no clue about Ada. I notice with joy that the keyword 'generic' is completely absent from your "solution" and the thing called 'func' is a System.Address. Looks like something a (bad) C programmer might have conceived after missing to read the introductory Ada material (e.g. a decent book or the ARM, which is astonishingly readable). Regards -- Markus > > > In <1188809249.040351.100160@r29g2000hsg.googlegroups.com>, shoshanister@gmail.com writes: >>I need your urgent help, I have an exam soon, and I still cant figure >>this out: >>I want to create a generic function that receives a generic procedure >>(without any parameters) as a parameter. >> >>Do you have any ideas? >>Thanks a lot. >>R >>