comp.lang.ada
 help / color / mirror / Atom feed
From: arnold.steve@ensco.com (Steve Arnold)
Subject: problem solved, but I don't know why (was: GNAT implementation bug)
Date: 2000/04/14
Date: 2000-04-14T00:00:00+00:00	[thread overview]
Message-ID: <8d7n1a$ee6@journal.concentric.net> (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?





             reply	other threads:[~2000-04-14  0:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-04-14  0:00 Steve Arnold [this message]
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
replies disabled

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