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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,47ad7b1ec6646e16 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-03-26 11:35:59 PST Path: supernews.google.com!sn-xit-02!supernews.com!news.gv.tsc.tdk.com!falcon.america.net!sunqbc.risq.qc.ca!newsfeed.direct.ca!look.ca!newshub2.rdc1.sfba.home.com!news.home.com!news1.sttls1.wa.home.com.POSTED!not-for-mail From: "Mark Lundquist" Newsgroups: comp.lang.ada References: <3ABA5AC3.4C6C7536@t-online.de> <3ABF3A34.D961881E@earthlink.net> Subject: Re: How pass a "null" as a parameter of anonymous access type X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2314.1300 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 Message-ID: <%RMv6.627588$U46.19174238@news1.sttls1.wa.home.com> Date: Mon, 26 Mar 2001 19:35:23 GMT NNTP-Posting-Host: 24.20.66.55 X-Complaints-To: abuse@home.net X-Trace: news1.sttls1.wa.home.com 985635323 24.20.66.55 (Mon, 26 Mar 2001 11:35:23 PST) NNTP-Posting-Date: Mon, 26 Mar 2001 11:35:23 PST Organization: Excite@Home - The Leader in Broadband http://home.com/faster Xref: supernews.google.com comp.lang.ada:6070 Date: 2001-03-26T19:35:23+00:00 List-Id: Marc A. Criley 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