From: "W. Wesley Groleau (Wes)" <wwgrol@PSERC041.FW.HAC.COM>
Subject: Is this correct?
Date: 1996/05/02
Date: 1996-05-02T00:00:00+00:00 [thread overview]
Message-ID: <9605022151.AA12098@most> (raw)
I'm not saying where this comes from. If you know, please
keep it to yourself and certainly don't flame the author.
It seems to me that the following won't work. Or are the
comments (all added by me) inaccurate?
function "="(Left : Stack; Right : Stack) return Boolean is
LC : Container_Pointer := Left.Head ; -- what if either
RC : Container_Pointer := Right.Head ; -- is null before call?
Equal : Boolean := True ; -- (caller gets exception)
begin -- "="
loop
Equal := LC.Value = RC.Value ;
LC := LC.Next ;
RC := RC.Next ;
exit when (LC = null or RC = null) or not Equal ;
-- I suspect a typo because parentheses are unnecessary
-- If top three items are equal, but only Right has a fourth, then
-- exit because LC = null and return True (incorrect).
end loop ;
return Equal ;
end "=";
reply other threads:[~1996-05-02 0:00 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox