From: "Mark Lundquist" <mark@rational.com>
Subject: Re: How pass a "null" as a parameter of anonymous access type
Date: Mon, 26 Mar 2001 19:35:23 GMT
Date: 2001-03-26T19:35:23+00:00 [thread overview]
Message-ID: <%RMv6.627588$U46.19174238@news1.sttls1.wa.home.com> (raw)
In-Reply-To: 3ABF3A34.D961881E@earthlink.net
Marc A. Criley <mcqada@earthlink.net> wrote in message
news:3ABF3A34.D961881E@earthlink.net...
> Freddy wrote:
> >
> > Hello !
> >
> > I want call a C-binding procedure which is defined as "procedure p (a :
> > access X; b : access Y);"
> > Both a or b may be a null pointer, but Ada say "null not allowed for
> > anonymous access type".
> > Any idea what to do ?
>
> Here's another approach, which worked with JGNAT both at compile-time
> and run-time:
>
> type X_Access is access all X;
> type Y_Access is access all Y;
>
> Null_X : constant X_Access := null;
> Null_Y : constant Y_Access := null;
>
> ...
>
> P(Null_X'access, Null_Y'access);
Hokey Smokes, Bullwinkle! :-)
>
>
> Even if this works (which it shouldn't),
No kidding... :-)
> you should submit a bug report
> to the providers of the binding
And to your Ada vendor...
Null_X is not aliased, so Null_X'Access is illegal.
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).
For that cr@p to compile *and* run would require an incredible conjunction
of bugs in the Ada implementation.
-- mark
next prev parent reply other threads:[~2001-03-26 19:35 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 [this message]
2001-03-27 12:59 ` Marc A. Criley
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