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,FREEMAIL_FROM, INVALID_MSGID,XPRIO autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1556a5535c129d37,start X-Google-Attributes: gid103376,public From: "Chad R. Meiners" Subject: Is this code legal Date: 1999/06/12 Message-ID: <929221299.108.55@news.remarQ.com>#1/1 X-Deja-AN: 488888043 X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211 X-Complaints-To: newsabuse@remarQ.com X-Trace: 929221299.108.55 ZYYQ2O1IFB368CE97C qube-02.us-ca.remarq.com Organization: Posted via RemarQ Communities, Inc. X-MSMail-Priority: Normal NNTP-Posting-Date: Sat, 12 Jun 1999 21:01:39 GMT Newsgroups: comp.lang.ada Date: 1999-06-12T00:00:00+00:00 List-Id: Yesterday I tracked down a bug in one of my programs where an Unbounded string was containing garbage and causing Index_errors. I traced the problem to the following code. -- All of this code is inside a procedure of a protected object Function Command_Buffer return Unbounded_String is -- Command_Buffers is an array of Unbounded_strings -- Current_Buffer is an index in this array which is the index of the current_buffer begin return Command_Buffers(Current_Buffer); end Command_Buffer; pragma Inline(Command_Buffer); Procedure Update_Buffer is True_Buffer : Unbounded_String renames Command_Buffer; Command_Buffer : Unbounded_string := True_Buffer; I have fixed the code by changing the True_Buffer declaration to an assignment as opposed to a renaming. I was wondering such a renaming is legal in Ada 95 since True_Buffer is an Unbounded_String and Command_Buffer is a function. Any help would be appricated. -Chad R. Meiners