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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.68.209.228 with SMTP id mp4mr7471538pbc.8.1374670882094; Wed, 24 Jul 2013 06:01:22 -0700 (PDT) X-Received: by 10.49.35.225 with SMTP id l1mr537514qej.1.1374670882033; Wed, 24 Jul 2013 06:01:22 -0700 (PDT) Path: border1.nntp.ams2.giganews.com!border2.nntp.ams2.giganews.com!border4.nntp.ams.giganews.com!border2.nntp.ams.giganews.com!nntp.giganews.com!news.astraweb.com!border5.a.newsrouter.astraweb.com!xlned.com!feeder1.xlned.com!news.glorb.com!ko2no96195891pbb.0!news-out.google.com!b2ni84402pby.1!nntp.google.com!qx7no53034844pbc.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 24 Jul 2013 06:01:21 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=136.163.203.9; posting-account=l8k8IwoAAADeDydswOzwNzmn10qOk9gt NNTP-Posting-Host: 136.163.203.9 References: <87mwplvthn.fsf@mid.deneb.enyo.de> <9a48d84b-4160-4824-a658-48dfcf12d0d6@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <862c7bde-dfbe-44a4-8180-017c4e73f585@googlegroups.com> Subject: Re: Accessibility checks From: ake.ragnar.dahlgren@gmail.com Injection-Date: Wed, 24 Jul 2013 13:01:22 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: number.nntp.dca.giganews.com comp.lang.ada:182667 Date: 2013-07-24T06:01:21-07:00 List-Id: On Monday, July 22, 2013 11:03:02 AM UTC+2, Bill Findlay wrote: > On 22/07/2013 07:11, in article 9a48d84b-4160-4824-a658-48dfcf12d0d6@goog= legroups.com, "ake.ragnar.dahlgren@gmail.com" wrote: > Den torsdagen den 18:e juli 2013 kl. 02:39:42 UTC+2 skrev Bill = Findlay: >> On 18/07/2013 00:44, in article ks7a8v$4nj$1@loke.gir.dk, "Rand= y Brukardt" >> wrote: > "Jeffrey Carter" >> wrote in message > >> news:ks718g$aim$2@dont-e= mail.me... >> Brukardt, ARG member and editor of the >> ARM, claims that 'A= ccess never >> works and 'Unchecked_Access is always >> required, bypassing= the >> accessibility checks. While this is not entirely >> true, it's quit= e common >> that one must use 'Unchecked_Access, so we could >> do without = these rules >> and checks in the majority of cases. > > That's not >> entir= ely true: I did find one (and only one) instance where I was > able to >> u= se 'Access in my code (it had to do with a library-level > initialization).= >> Interesting. My projects have 37 occurrences of 'Access and only 2 of >= > 'Unchecked_Access. -- Bill Findlay with blueyonder.co.uk; use surname & >= > forename; > > Perhaps your projects use anonymous access types? No, I do = not use any anonymous access types. -- Bill Findlay with blueyonder.co.uk; = use surname & forename; I do not use anonymous access types either. A recipe for avoiding 'Unchecked_Access could be: 1) Instantiate as many objects at the library level as is suitable to be ab= le to use 'Access. 2) The objects that are unnecessary to instantiate at startup (to avoid lon= g startup time if the application is HUGE and use resources more wisely) ar= e instantiated on the heap using smart pointers =E1 la GNATColl. The recipe is obviously not usable in projects where dynamic allocations ar= e forbidden. To deal with "the objects that are unnecessary to instantiate at startup" I= can think of four scenarios: 1) Using anonymous access types. 2) Using Unchecked_Access 3) Dynamic allocation on the heap. 4) Dynamic allocation on the heap using smart pointers =E1 la GNATColl. Case 1) and 2) can lead to access types referencing non-existant objects. C= ase 3) can lead to memory leaks. Out of these case 4) seems to be safest si= nce it protects against null pointer exceptions and memory leaks (although = it won't protect from out of memory exceptions). Perhaps it is possible to = verify using static code analysis that one has correctly used anonymous acc= ess types and Unchecked_Access in cases 1) and 2)? Maybe someone who has us= ed CodePeer knows? Anyways, I would like to extend my thanks to everyone who has participated = in the "Accessibility checks" discussion. It gave me something to think abo= ut. Best regards, =C5ke Ragnar Dahlgren