comp.lang.ada
 help / color / mirror / Atom feed
From: claveman@grzorgenplatz.net (Charles H. Sampson)
Subject: Subprogram Pointer in a Generic
Date: Wed, 16 Apr 2003 18:53:56 -0700
Date: 2003-04-16T18:53:56-07:00	[thread overview]
Message-ID: <1ftiuys.1twhum2q9qa00N%claveman@grzorgenplatz.net> (raw)

     I'm using a procedure that takes a procedure pointer as an
argument.  It's pretty standard stuff:

          type Parameterless_Proc_Ptr is access procedure;
          procedure Register (The_Proc : in Parameterless_Proc_Ptr);

     My problem occurs when I want to call this procedure from within a
generic package.  I can't, because 3.10.2(32) says "If the subprogram
denoted by P [the prefix of 'Access] is declared within a generic body,
S [the access-to-subprogram type of the formal parameter] shall be
declared within the generic body."

     Now that's no good for me at all, so I've kludged my way around it
by taking the address of the actual argument procedure and changing it
to a pointer using Unchecked_Conversion, a technique guaranteed to work
for the current version of my current compiler on my current target
machine.

     There are two questions.  (1) What are they trying to prevent by
this restriction?  (2) Is there a more robust way of working around it?

                                Charlie

-- 
     For an email response, my real user name is csampson and my ISP is
inetworld.net.



             reply	other threads:[~2003-04-17  1:53 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-17  1:53 Charles H. Sampson [this message]
2003-04-17  2:54 ` Subprogram Pointer in a Generic James S. Rogers
2003-04-17  3:15   ` Samuel Tardieu
2003-04-17  5:27     ` tmoran
2003-04-17  3:12 ` Samuel Tardieu
2003-04-17  4:17   ` tmoran
2003-04-17 20:24     ` Robert A Duff
2003-04-18  2:59   ` Charles H. Sampson
2003-04-22 16:34   ` Warren W. Gay VE3WWG
2003-04-22 21:17     ` Robert A Duff
2003-04-23 20:46       ` Warren W. Gay VE3WWG
2003-04-17 19:41 ` Matthew Heaney
2003-04-17 20:39 ` Robert A Duff
2003-04-17 23:14   ` Randy Brukardt
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox