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-27 09:01:52 PST Path: supernews.google.com!sn-xit-02!supernews.com!news.gv.tsc.tdk.com!news.iac.net!news-out.cwix.com!newsfeed.cwix.com!news.maxwell.syr.edu!oleane.net!oleane!nnrp.oleane.net!not-for-mail From: Thierry Lelegard Newsgroups: comp.lang.ada Subject: Re: How pass a "null" as a parameter of anonymous access type Date: Tue, 27 Mar 2001 18:53:32 +0200 Organization: CANAL+ Technologies Message-ID: <3AC0C58C.F5E2C4F6@canal-plus.fr> References: <3ABA5AC3.4C6C7536@t-online.de> <3ABB11F2.C35C58FD@canal-plus.fr> <3ABE6443.4119AB52@t-online.de> NNTP-Posting-Host: host227.canal-plus.fr Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------86CA0C3050C50808AD2C0CB1" X-Trace: s1.read.news.oleane.net 985712012 3665 194.2.208.227 (27 Mar 2001 16:53:32 GMT) X-Complaints-To: abuse@oleane.net NNTP-Posting-Date: Tue, 27 Mar 2001 16:53:32 +0000 (UTC) X-Sender: "Thierry Lelegard" (Unverified) X-Mailer: Mozilla 4.75 [fr]C-CCK-MCD C+ (WinNT; U) X-Accept-Language: en,fr,zh-CN,zh-TW Xref: supernews.google.com comp.lang.ada:6125 Date: 2001-03-27T18:53:32+02:00 List-Id: Il s'agit d'un message multivolet au format MIME. --------------86CA0C3050C50808AD2C0CB1 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit > Freddy wrote in message > news:3ABE6443.4119AB52@t-online.de... > > Thanks. I've tried it, but at runtime I always get a constraint_error > > (GNAT seems to check the passing of "null" values). > > Yes -- as any correct Ada compiler must do! > > The value "null" just does not exist for the type of the parameter. > > Now, you might be able use "pragma Suppress (Access_Check)" to defeat this. I don't agree. I don't use the value "null". I use a variable which pretends to be at address zero. The following example works with GNAT 3.15w (20010305) on Sun Solaris. But, again, this is a hack, unsupported non-standard Ada. $ cat tnull.adb with System; procedure Tnull is Null_Access : aliased Integer; for Null_Access'Address use System.Null_Address; procedure Tnull_C (X : access Integer); pragma Import (C, Tnull_C, "tnull_c"); begin Tnull_C (Null_Access'Access); end Tnull; $ $ cat tnull_c.c #include void tnull_c (int *x) { printf ("x add = %08X\n", x); } $ $ gcc -c tnull_c.c $ gnatmake tnull -largs tnull_c.o gcc -c tnull.adb gnatbind -x tnull.ali gnatlink tnull_c.o tnull.ali $ tnull x add = 00000000 $ -Thierry ____________________________________________________________________________ Thierry Lelegard, "The Jazzing Troll", Email: thierry.lelegard@canal-plus.fr CANAL+ Technologies, 34 place Raoul Dautry, 75516 Paris Cedex 15, France Tel: +33 1 71 71 54 30 Fax: +33 1 71 71 52 08 Mobile: +33 6 03 00 65 75 ____________________________________________________________________________ --------------86CA0C3050C50808AD2C0CB1 Content-Type: text/x-vcard; charset=us-ascii; name="thierry.lelegard.vcf" Content-Transfer-Encoding: 7bit Content-Description: Carte pour Thierry Lelegard Content-Disposition: attachment; filename="thierry.lelegard.vcf" begin:vcard n:Lel�gard;Thierry tel;cell:+33 6 03 00 65 75 tel;fax:+33 1 71 71 52 08 tel;work:+33 1 71 71 54 30 x-mozilla-html:FALSE url:www.canalplus-technologies.com org:Canal+ Technologies adr:;;34, Place Raoul Dautry;Paris;;75516;France version:2.1 email;internet:thierry.lelegard@canal-plus.fr fn:Thierry Lel�gard end:vcard --------------86CA0C3050C50808AD2C0CB1--