comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@bix.com
Subject: Re: Ada Queue
Date: 2000/04/06
Date: 2000-04-06T00:00:00+00:00	[thread overview]
Message-ID: <K77H4.420$Qy3.109906@news.pacbell.net> (raw)
In-Reply-To: 38ecc752@news.hamilton.edu

>I need to explain why I chose to iterate through using the variable that was
>passed instead of the temporary variable.  The only thing I can think of
>is that I tried it and it worked.  Trial and error.  Perhaps it's not as
  As in explain to your professor/boss?  "I tried it and it worked" may
be accurate, but it doesn't show you in the best light as a programmer. ;)

>I was wondering if any one could shed some light as to another reason this
>solution works well, or why someone might choose it.
  If you changed the variable name "New_Queue" to "Queue_Head", it
would be a little clearer, since New_Queue doesn't point to anything
new, and in particular not to any new queue, but in fact just
temporarily saves the old value of Q while you go off using the
variable Q, not as a pointer to a (complete) queue, but as a
pointer *into* the queue.  OTOH, if you changed
   New_Queue : Queue;
to
   Cursor : Queue := Q;
and dropped the
       New_Queue := Q;
and the
       Q := New_Queue;
and replaced all occurences of Q in the "true" branch of the "if"
with Cursor then the routine might be a little clearer, though
the fundamental algorithm is the same.




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

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-04-06  0:00 Ada Queue Joseph T.
2000-04-06  0:00 ` Ted Dennison
2000-04-06  0:00   ` Joseph T
2000-04-06  0:00     ` tmoran [this message]
2000-04-08  0:00       ` tmoran
2000-04-06  0:00     ` Ted Dennison
2000-04-06  0:00       ` Joseph T.
2000-04-07  0:00         ` Ole-Hjalmar Kristensen
2000-04-07  0:00           ` Joseph T
2000-04-07  0:00             ` Ted Dennison
2000-04-07  0:00         ` Ted Dennison
2000-04-07  0:00           ` Hyman Rosen
2000-04-06  0:00     ` Robert Dewar
2000-04-06  0:00       ` Joseph T
2000-04-07  0:00         ` Ole-Hjalmar Kristensen
2000-04-06  0:00       ` Ted Dennison
2000-04-07  0:00 ` MaggieJohn
2000-04-07  0:00   ` Ted Dennison
2000-04-07  0:00 ` Simon Wright
2000-04-09  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