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.6 required=5.0 tests=BAYES_00,TO_NO_BRKTS_FROM_MSSP autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e71f392e041bf2c4 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-08-20 07:36:33 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!feed.textport.net!newsranger.com!www.newsranger.com!not-for-mail Newsgroups: comp.lang.ada From: Ted Dennison References: <3B7DF879.5755DC02@ida.his.se> Subject: Re: prefix of attribute has deeper level than allocator type Message-ID: X-Abuse-Info: When contacting newsranger.com regarding abuse please X-Abuse-Info: forward the entire news article including headers or X-Abuse-Info: else we will not be able to process your request X-Complaints-To: abuse@newsranger.com NNTP-Posting-Date: Mon, 20 Aug 2001 10:36:14 EDT Organization: http://www.newsranger.com Date: Mon, 20 Aug 2001 14:36:14 GMT Xref: archiver1.google.com comp.lang.ada:12128 Date: 2001-08-20T14:36:14+00:00 List-Id: In article <3B7DF879.5755DC02@ida.his.se>, Michael Andersson says... >What does the following error message mean? >prefix of attribute has deeper level than allocator type > >What I'm trying to do is to dynamically create a terrain like this: >type Terrain(HeaderFileFileName : access String) is new >Limited_Controlled with private; >. >. >. >T := new Terrain(Str'Access); (This is where I get the error >message) We just had a thread about this Friday. 'Access /= 'Unchecked_Access. That means there *are* checks that happen when you do a 'Access. In particular, it will check to see that the *type* of the object you are assigning into is not longer-lived (based on the scope of its declaration) than the object you are taking the 'Access of. The type in this case is implicitly declared when Terrain is declared. Thus Str has to be declared at the same scope (or a higher scope) than Terrain. Alternatively, you can use 'Unchecked_Access. In that case there will be no check, and it will be your full responsitibilty to ensure that "Str" will always exist as long as the terrain object you just dynamicly allocated exists. If Str isn't declared at the library level (in a package body or spec), then odds are it *will* go out of scope during the lifetime of your dynamicly-allocated object, and the compiler acutally caught an error here. --- T.E.D. homepage - http://www.telepath.com/dennison/Ted/TED.html home email - mailto:dennison@telepath.com