comp.lang.ada
 help / color / mirror / Atom feed
* problem solved, but I don't know why (was: GNAT implementation bug)
@ 2000-04-14  0:00 Steve Arnold
  2000-04-14  0:00 ` problem solved (and now I know why) Stephen Arnold
  2000-04-14  0:00 ` problem solved, but I don't know why (was: GNAT implementation bug) Tucker Taft
  0 siblings, 2 replies; 5+ messages in thread
From: Steve Arnold @ 2000-04-14  0:00 UTC (permalink / raw)


It looks like I solved the problem, but I still have no idea why there was a 
problem in the first place (being a newbie, it seems like it *should've* 
worked).

When I replaced the following (in Remove):

       if List.Count = 1 then
          Clear(List) ;
       elsif List.Cursor = List.Head then...

with the actual code from Clear:

       if List.Count = 1 then
          List := (Count => 0, Traversing => False, others => null) ;
       elsif List.Cursor = List.Head then...

it started working correctly.  But I still have at least two questions (on 
this particular issue, anyway ;)

1) Why did this code behave differently when running under Linux than when 
running under windoze?  (obvious answer: windoze is brain-dead)

2) Why did my trivial change fix it?

In other parts of these packages, I call functions/procedures that were 
defined in the same package, and it always worked.  For example, I do this:

   begin -- Remove
       if List.Count = 0 then
          Ada.Exceptions.Raise_Exception (Cursor_Error'identity,...

which should always work.  But I also do this (which seems more readable to 
me):

      elsif Empty(List) then
         Ada.Exceptions.Raise_Exception (Cursor_Error'identity,...

where function Empty is in the same package as Remove, Clear, etc, and this 
also works (at least it seems to).  Am I doing something wrong?  Is there only 
a potential problem doing this when the called function/procedure is 
manipulating pointers?  Just what is going on here?  When is it safe to do 
this (if ever) and when is it not safe?





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2000-04-15  0:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-04-14  0:00 problem solved, but I don't know why (was: GNAT implementation bug) Steve Arnold
2000-04-14  0:00 ` problem solved (and now I know why) Stephen Arnold
2000-04-15  0:00   ` Florian Weimer
2000-04-14  0:00 ` problem solved, but I don't know why (was: GNAT implementation bug) Tucker Taft
2000-04-15  0:00   ` Robert Dewar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox