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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,e7d9fee9b42cd34e,start X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!f6g2000cwb.googlegroups.com!not-for-mail From: "Anh Vo" Newsgroups: comp.lang.ada Subject: Not null feature with anonymous and named access types Date: 12 Jun 2006 13:33:16 -0700 Organization: http://groups.google.com Message-ID: <1150144396.104055.164310@f6g2000cwb.googlegroups.com> NNTP-Posting-Host: 209.225.227.70 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1150144401 29854 127.0.0.1 (12 Jun 2006 20:33:21 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 12 Jun 2006 20:33:21 +0000 (UTC) User-Agent: G2/0.2 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.1.4322),gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: f6g2000cwb.googlegroups.com; posting-host=209.225.227.70; posting-account=JVr7Xg0AAAAI3MbuARxMmvWLmA7qdJMx Xref: g2news2.google.com comp.lang.ada:4753 Date: 2006-06-12T13:33:16-07:00 List-Id: I have been exploring the not null feature with anonymous access type and named access type. One thing have learned that an access variable declared based on these types will raise a Constraint_Error when deallocating this access variable as shown in the code below. Access_Type: declare type Access_Integer is not null access all Integer; procedure Free is new Unchecked_Deallocation (Integer, Access_Integer); My_Ref_1 : Access_Integer := new Integer' (111); My_Ref_2 : not null access Integer := new Integer' (222); begin -- perform action on My_Ref_1 and My_Ref_2 Free (My_Ref_1); -- raising Constraint_Error under GNAT/gcc-4.2.0 Free (Access_Integer (My_Ref_2)); -- did too end Access_Type; Does this behavior reflect ARM 2005 requirements? Thanks in advance for your comments. AV