swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Want to delete item from list. Can't understand archived notes


From: Michael Whidden
Subject: Re: Want to delete item from list. Can't understand archived notes
Date: Thu, 23 Jul 1998 07:44:19 -0400

Paul E. Johnson wrote:

I'll answer in comments to each statement

> Now Just one more question.
>   Sometimes while statements using indexes are written like this:
>       while (( aRecruiter=[index next]))

Loops until the parenthesized expression is 'false'.  NULL is a
'false' value, and the value of a assignment (=) is the value of
right-hand side.  So, when [index next] returns NULL, the while
loop exits

>   and other times, by other people, they are written like this
>       while (( [index next] != NULL)
This does the same thing by an explicit comparison because,
technically, on some systems (although, I've never seen one)
NULL is not a false value itself.  Because [index next] is
not assigned to anything, it is assumed you will retrieve
the current list item via [index get] inside the loop.

>   and yet other times it is
>       while (( aRecruiter = [index next] != NULL))
This checks for NULL while assigning the next item
to aRecruiter so you don't have to call [index get] 
inside the while loop.

> Why these differences?  It seems to me the !=NULL is superfluous ?

Like I said above, supposedly, on some machines, NULL is not '0', and
so may not be false.  (I think some old wierd architectures used 
'-1' for NULL or something

> And including the object name gives something to reference inside the
> while?
Yup.

-- 
This message does not reflect the opinions of my employer.
 Michael Whidden                   Lockheed Martin Information Systems
 Phone: (781) 505-9542             Advanced Simulation Center
 Fax:   (781) 505-9501             37 North Ave
 Email: address@hidden  Burlington, MA 01803

                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.
                  ==================================


reply via email to

[Prev in Thread] Current Thread [Next in Thread]