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 Path: g2news2.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx02.iad01.newshosting.com!newshosting.com!198.186.194.250.MISMATCH!news-out.readnews.com!news-xxxfer.readnews.com!panix!bloom-beacon.mit.edu!newsswitch.lcs.mit.edu!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Ada Shootout program for K-Nucleotide (patches) Date: Fri, 04 Sep 2009 17:51:20 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <4a743343$0$32674$9b4e6d93@newsspool2.arcor-online.net> <3f9f9e21-e088-4fbe-baac-dd43fdf6b911@r38g2000yqn.googlegroups.com> <4a757b0d$0$31328$9b4e6d93@newsspool4.arcor-online.net> <4a9fc85a$0$2850$ba620e4c@news.skynet.be> <1a5e1270-6a0a-4fff-a9b4-965abe610b69@o9g2000yqj.googlegroups.com> <4a9fdd46$0$2853$ba620e4c@news.skynet.be> <4aa0afbf$0$2864$ba620e4c@news.skynet.be> <3df8815d-b65a-4f73-9015-65375dcff113@x38g2000yqb.googlegroups.com> <4aa0e963$0$2868$ba620e4c@news.skynet.be> <0709cb9b-6144-4b14-a555-97262b1fa7b7@x37g2000yqj.googlegroups.com> <4aa15bc7$0$32679$9b4e6d93@newsspool2.arcor-online.net> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls6.std.com 1252101080 19474 192.74.137.71 (4 Sep 2009 21:51:20 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Fri, 4 Sep 2009 21:51:20 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:xzyDQ1Lrq5uHYoZSFgRycdOQCLI= Xref: g2news2.google.com comp.lang.ada:8168 Date: 2009-09-04T17:51:20-04:00 List-Id: Georg Bauhaus writes: > Martin schrieb: > >> . function Get_Key (E : Element_Access) return >> Fragment is >> . begin >> 1,395,255,084 return E.all.Key; >> >> Is there some accessibility check going on in this? Could a 'pragma >> Assert (E.all /= null);' help? No, pragma Assert will not help, efficiency-wise. There is no accessibility check, here. There's a null check, which can be suppressed, assuming you "know" it can't fail. > I'll try this. Thanks. (-gnatp is on; does it suppress > accessibility checks, too?) -gnatp controlls language-defined checks, including the above null check. Pragma Assert is not affected by -gnatp -- pragma Assert is off by default, and is turned on by -gnata. If pragma Assert is turned off, the compiler does not base any optimization decisions on it -- it's as if it were just erased from the program. > Hm. Null excluding subtypes... Yes, I believe adding "not null" will eliminate the above null check in recent versions of GNAT. The null check then moves to the call site. I didn't look at the whole code, but if you're lucky, the call site will also have "not null" -- the idea is to push the "not null"s as far as possible, until you get to "new" or "'Access", which obviously cannot return null. But if you're using -gnatp, all null checks will be eliminated anyway. - Bob