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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM,WEIRD_PORT autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,23ca868289d9f0c X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!m7g2000cwm.googlegroups.com!not-for-mail From: "cl1" Newsgroups: comp.lang.ada Subject: Re: generic package with procedure paramter gives "not subtype conformant with declaration" Date: 30 Sep 2006 23:02:18 -0700 Organization: http://groups.google.com Message-ID: <1159682538.644835.248030@m7g2000cwm.googlegroups.com> References: <1159651201.121690.130430@b28g2000cwb.googlegroups.com> NNTP-Posting-Host: 66.160.210.65 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1159682543 5356 127.0.0.1 (1 Oct 2006 06:02:23 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sun, 1 Oct 2006 06:02:23 +0000 (UTC) In-Reply-To: User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/418.9 (KHTML, like Gecko) Safari/419.3,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: m7g2000cwm.googlegroups.com; posting-host=66.160.210.65; posting-account=MCxsfw0AAABxs2rB6FOIOk-6XLUrvbBM Xref: g2news2.google.com comp.lang.ada:6818 Date: 2006-09-30T23:02:18-07:00 List-Id: Jeffrey R. Carter wrote: > cl1 wrote: > > --avcall-register_type.adb:13:34: not subtype conformant with > > declaration at avcall.ads:37 > > --avcall-register_type.adb:13:34: formal subprograms not allowed > > Info.Av_Param := Av_Param_Instance'Access; > > > > You seem to have cut things down a bit too much. avcall.ads has no line > 37. If you're going to cut things down this much, please post messages > that result from compiling the cut-down code. that is why i posted the very last section called so you could see which line it was. I didn't think to compile the cut down code. I appologize. line 37 is lines 23 and 24 in the snippet of avcall.ads > > You shouldn't use System.Address to interface to C. Use a convention-C > access type instead. I understand the reason for using access types with convention C, but that will not work for this situation. Everywhere i have used System.Address the code does not know, does not care what type or subprogram signature is stored there, and will not use it other than to pass it along to some c function that knows what to do with it. If there is a System.Address being used that doesn't fit that, then it is a bug. I also choose not to use 'type void_ptr is new System.Address;' specifically becuase that is what System.Address is. Also someone once told me that writing code that requires the user to with System; alerts the user that the code is system dependant. I like that idea. This code is system dependant. By that, I mean it is dependant on the processor and in some situations the operating system, not the compiler implementation. Well to be honest the Ada code isn't but the C code it interfaces with is (ffcall's avcall). > > > I don't understand why i can't pass Av_Param to the generic package (in > > test_call_avcall_register_type.adb) and have its 'Access attribute used > > in Concat (the offending code in avcall-register_type.adb)? > > You don't say what version of GNAT you're using. i'm using GPS which has gcc version 3.4.6 on mac os x 10.4.8 > However, I suspect what > you're running into is an accessibility control problem. You can't store > the generic formal procedure's 'access because the compiler can't be > sure that the life of the access value is no longer than the life of the > actual procedure. I agree with you. However, I am confused about this. The procedure could be declared anywhere. How does the compiler know what scope the procedure that is supplied to the generic package is in? I mean can it ever know? If not, that means there is no foreseeable fix to this issue from my point of view. > > -- > Jeff Carter > "Sir Lancelot saves Sir Gallahad from almost certain temptation." > Monty Python & the Holy Grail > 69