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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8c350c9f790688d,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-02-11 11:15:03 PST Path: archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!crtntx1-snh1.gtei.net!news.gtei.net!newsfeed1.easynews.com!easynews.com!easynews!c03.atl99!news.usenetserver.com!news.mailgate.org!nntp.infostrada.it!news-out.tin.it!news-in.tin.it!news3.tin.it.POSTED!not-for-mail From: "Francesco Bochicchio" Subject: renames and access User-Agent: Pan/0.13.0 (The whole remains beautiful (Debian GNU/Linux)) Message-ID: Newsgroups: comp.lang.ada MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Date: Wed, 11 Feb 2004 19:15:02 GMT NNTP-Posting-Host: 80.181.243.137 X-Complaints-To: newsmaster@tin.it X-Trace: news3.tin.it 1076526902 80.181.243.137 (Wed, 11 Feb 2004 20:15:02 MET) NNTP-Posting-Date: Wed, 11 Feb 2004 20:15:02 MET Organization: TIN Xref: archiver1.google.com comp.lang.ada:5446 Date: 2004-02-11T19:15:02+00:00 List-Id: Hi all, I have a piece of code that does something like this: type REC_T is record A : Integer; B : String(4) end record; type REC_PTR_T is access REC_T; REC_PTR : REC_PTR_T := new REC_T; A renames REC_PTR.A; B renames REC_PTR.B; At this point, I can use A and B as if they where simple variables. BUT, when I later reallocate the memory like this: function REALLOCATE_MEMORY return REC_PTR_T; REC_PTR := REALLOCATE_MEMORY(); -- Actually, the ability to reallocate is -- the reason for all this fuss. -- then A and B still points to the old memory, not at the one currently pointed by REC_PTR. Is this normal ??(I work with ObjectADA, did not try yet with GNAT) Is there any way to have the renames to automatically points to the new memory? If this turns impossible, what would be an equivalent solution? At the moment, my bet is to turn the renames into access. Any better idea? BACKGROUND : the reason for all this is that we are trying to add a failover capability to a very old application of many thousand lines of code. Therefore, the 'critical variables' (one hundred or more) shall be allocated in a special area of memory which is mirrored between the primary machine and its backup, where a copy of the application runs in hot standby. The trick with the renames should have spared us from changing every line of code referring to one of these variables. Thanks for any hints you can give me. Ciao ----- FB