From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,f32236e7e55b02e0 X-Google-Attributes: gid103376,public From: tmoran@bix.com Subject: Re: Ada Queue Date: 2000/04/06 Message-ID: #1/1 X-Deja-AN: 607722039 References: <38ecc752@news.hamilton.edu> X-Complaints-To: abuse@pacbell.net X-Trace: news.pacbell.net 955055722 206.170.2.12 (Thu, 06 Apr 2000 14:15:22 PDT) Organization: SBC Internet Services NNTP-Posting-Date: Thu, 06 Apr 2000 14:15:22 PDT Newsgroups: comp.lang.ada Date: 2000-04-06T00:00:00+00:00 List-Id: >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.