[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: |
Piotr Sieniawski |
Subject: |
Re: Want to delete item from list. Can't understand archived notes |
Date: |
Thu, 23 Jul 1998 15:22:57 +0200 (MET DST) |
On Thu, 23 Jul 1998, Michael Whidden wrote:
> 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
>
One more thing.
You can use
while (aRecruiter=[index next])
or
while (aRecruiter=[index next] != NULL)
but what if some day by mistake you use
while (aRecruiter=bRecruiter)
instead of (aRecruiter==bRecruiter)
This typo is very hard to find. And if somebody else try to watch youre
code, he won't be sure if this is correct or wrote by mistake.
==================================
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.
==================================