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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,feb9db77c9b5b310 X-Google-Attributes: gid103376,public From: dewar@merv.cs.nyu.edu (Robert Dewar) Subject: Re: Access to Unconstrained Arrays Date: 1997/04/23 Message-ID: #1/1 X-Deja-AN: 237032196 References: <335507B4.7A03@boeing.com> <3357B77F.44EE@boeing.com> <1997Apr21.005646.25460@ocsystems.com> Organization: New York University Newsgroups: comp.lang.ada Date: 1997-04-23T00:00:00+00:00 List-Id: Bob Duff said <> Well of course it is true that thin pointers are simpler, but they are also less efficient. In particular, they rule out the use of virtual origins for arrays. GNAT offers the programmer the choice of fat or thin pointers (to get thin pointers, you use a size clause on the access type that restricts it to address size). However, since we do provide fat pointers, we can indeed allow 'Access of slices under some circumstances. For example, the following program with Text_IO; use Text_IO; procedure a is type ax is access all String; q : String (1 .. 11) := "Hello World"; p : ax; begin p := q (1 .. 5)'Unrestricted_Access; Put_Line (p.all); end a; Of course this program is not portable (it is relying on the implementation dependent attribute Unrestricted_Access). It is however reliably portable to all GNAT implementations. You cannot use 'Access itself this way of course, since that is not legal Ada!