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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!gandalf.srv.welterde.de!news.jacob-sparre.dk!loke.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Access parameters and accessibility Date: Wed, 17 Dec 2014 16:58:10 -0600 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: NNTP-Posting-Host: rrsoftware.com X-Trace: loke.gir.dk 1418857100 7288 24.196.82.226 (17 Dec 2014 22:58:20 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Wed, 17 Dec 2014 22:58:20 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Xref: news.eternal-september.org comp.lang.ada:24083 Date: 2014-12-17T16:58:10-06:00 List-Id: "Natasha Kerensikova" wrote in message news:slrnm92hsh.nrc.lithiumcat@nat.rebma.instinctive.eu... > On 2014-12-17, Dmitry A. Kazakov wrote: >> On Wed, 17 Dec 2014 07:02:56 +0000 (UTC), Natasha Kerensikova wrote: >> >>> Now you got me really worried, because I thouhgt access discriminants >>> were safe. It was under that assumption that I actually started to >>> really like them. >>> >>> More specifically, the pattern I caught myself using a lot looks like >>> the following: >>> >>> type Preprocessed_Data (Input_Data : access Input_Data_Type) is >>> record >> >> not null access? > > I tought access discriminants were not allowed to be null. > Has that changed? > Or do you advise "not null access" to make it explicit? Explicit is always better, regardless of the rules. Ada 95 did not define null for anonymous access types, but all more recent versions of Ada do. The only implicit restriction against null that I remember in modern Ada is for dispatching anonymous access parameters. See 3.10(13.1/2). Ahh, yes, AARM 3.10(26.c/2) says: Inconsistences with Ada 95 Access discriminants and noncontrolling access parameters no longer exclude null. A program which passed null to such an access discriminant or access parameter and expected it to raise Constraint_Error may fail when compiled with Ada 2005. One hopes that there no such programs outside of the ACATS. (Of course, a program which actually wants to pass null will work, which is far more likely.) Moral: If you're programming for Ada 2005 or later, always use a null exclusion when that makes sense. (It's even a good idea on controlling parameters, we would have preferred to require it but that would have been severely incompatible with Ada 95.) Randy.