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,72a0bc6240d264e3 X-Google-Attributes: gid103376,public From: Laurent Guerby Subject: Re: Access and alias Date: 2000/04/04 Message-ID: <86d7o5ae23.fsf@ppp-169-201.villette.club-internet.fr>#1/1 X-Deja-AN: 606688671 References: X-Trace: front4.grolier.fr 954874369 19520 195.36.223.183 (4 Apr 2000 18:52:49 GMT) Organization: Club-Internet (France) NNTP-Posting-Date: 4 Apr 2000 18:52:49 GMT Newsgroups: comp.lang.ada Date: 2000-04-04T18:52:49+00:00 List-Id: "NANCY HEHIR" writes: > I don't understand my compile error and am having trouble finding help in > GNAT or Annotated Reference Manual. > > Can anyone explain what's going wrong here, please ? > I am trying to assign an initial address to an access variable..... > > type LPDCB is access all DCB; > . > . > DCB_1:DCB; Try: DCB_1 : aliased DCB; > . > . > DCB_Access:LPDCB := DCB'Access; > > compiler generates error 'prefix of "Access" attribute must be aliased' However, it is very "rare" in Ada to use aliased variables, if you're from a C background and try to write Ada like you write C I think adding "aliased" and "'access" everywhere is not the right thing to do. A possible guess is that you are emulating the use of "&" in C with aliased/access, and that the right way to do it in Ada is to use the "in out" parameter mode. May be if you tell us more about what you're trying to do, we can suggest appropriate Ada idioms (note that may be the use of aliased and access is the appropriate idiom here ;-). --LG