comp.lang.ada
 help / color / mirror / Atom feed
From: "Marc A. Criley" <mcqada@earthlink.net>
Subject: Re: How pass a "null" as a parameter of anonymous access type
Date: Tue, 27 Mar 2001 12:59:44 GMT
Date: 2001-03-27T12:59:44+00:00	[thread overview]
Message-ID: <3AC08123.48F4E955@earthlink.net> (raw)
In-Reply-To: %RMv6.627588$U46.19174238@news1.sttls1.wa.home.com

Mark Lundquist wrote:
> 
   <snips>
> 
> Null_X is not aliased, so Null_X'Access is illegal.

Mea culpa, I mistyped.  Yes, it is not Null_X'Access that was used,
merely Null_X.

> 
> Make it aliased, then you can take the 'Access... but then, Null_X'Access
> should *not* yield a null value (the fact that Null_X itself *has* a null
> value is irrelevant, the value of Null_X makes no difference).
> Null_X'Access by definition yields an access value that denotes the object
> Null_X (and a null value does not denote anything... that's why it's called
> "null" :-).
> 
> And even if there is some compiler bug that would cause Null_X'Access to
> yield a null value, that should cause Constraint_Error to be raised when
> it's passed to P (it doesn't matter where the null value came from).
> 

Well, not necessarily...  I ran into this same problem when using JGNAT
and the bindings that product produces for interfacing to the JDK.  As I
mentioned, the way I got around this was by using a (correctly formed)
constant null pointer.  That suggestion was made in response to a
posting I made in this group about 3 weeks ago.  There was some
follow-up discussion, and Tucker Taft chimed in with the reason that
this approach was allowable with JGNAT:

From: Tucker Taft (stt@averstar.com)
 Subject: Re: JGNAT and Null references 
 Newsgroups: comp.lang.ada
 Date: 2001-03-07 08:04:05 PST 

Randy Brukardt wrote:
> 
> Marc A. Criley wrote in message <3AA151BF.C9193700@earthlink.net>...
> >Uh...it did work.  Cleared up the problem just fine.  That it works
> >doesn't totally sit well with me, since my purist mental picture of a
> >"constant" involves only a value, and not storage.  Nonetheless,
> >
> >   Null_Icon : constant Javax.swing.TabbedPanel.ref := null;
> >
> >was accepted by the AddTab procedure call.
> 
> But does it run? The RM  4.6(49) says that an access parameter cannot be
> null, and must raise Constraint_Error. If it does run, you're using a
> compiler bug (or "feature"); your code won't be portable...

There was discussion of avoiding the null check when interfacing
with code from some other language (e.g. C or Java).  Given that the
rules for making Java-convention calls are not standardized at
this point, so long as there is an explicit (or implicit?) Java
convention on the routines, JGNAT can do what it wants at this point.

> 
>         Randy. 
-- 
-Tucker Taft   stt@avercom.net   http://www.averstar.com/~stt/



  reply	other threads:[~2001-03-27 12:59 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-03-22 20:04 How pass a "null" as a parameter of anonymous access type Freddy
2001-03-22 21:02 ` tmoran
2001-03-25 21:32   ` Freddy
2001-03-26 14:31     ` How pass a Ted Dennison
2001-03-23  9:05 ` How pass a "null" as a parameter of anonymous access type Thierry Lelegard
2001-03-25 21:33   ` Freddy
2001-03-26 19:17     ` Mark Lundquist
2001-03-27 16:13       ` Alfred Hilscher
2001-03-27 16:53       ` Thierry Lelegard
2001-03-26 13:44 ` Marc A. Criley
2001-03-26 19:35   ` Mark Lundquist
2001-03-27 12:59     ` Marc A. Criley [this message]
2001-03-27 16:12       ` Alfred Hilscher
replies disabled

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