From: "Chad R. Meiners" <crmeiners@hotmail.com>
Subject: Is this code legal
Date: 1999/06/12
Date: 1999-06-12T00:00:00+00:00 [thread overview]
Message-ID: <929221299.108.55@news.remarQ.com> (raw)
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);
<unrelated procedure sniped>
Procedure Update_Buffer is
<unrelated declares sniped>
True_Buffer : Unbounded_String renames Command_Buffer;
<unrelated Declares sniped>
Command_Buffer : Unbounded_string := True_Buffer;
<rest of procedure snipped>
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
next reply other threads:[~1999-06-12 0:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-06-12 0:00 Chad R. Meiners [this message]
1999-06-12 0:00 ` Is this code legal Matthew Heaney
1999-06-14 0:00 ` Tucker Taft
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox