[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: what's wrong with this use of the index to clean a list?
From: |
famasce |
Subject: |
Re: what's wrong with this use of the index to clean a list? |
Date: |
Fri, 29 Oct 1999 11:16:56 +0200 |
> I found a little problem that a list called "offerList" was not getting
> cleaned out when I wanted it to. I don't understand why id does not, but
> I keep getting the exit at the end.
> I found a little problem that a list called "offerList" was not getting
> cleaned out when I wanted it to. I don't understand why id does not, but
> I keep getting the exit at the end.
I tried the following code....
int main (int argc,const char **argv)
{
int idx;
Coalition *coal;
id <List> aList;
id <Index> listIndex;
initSwarm (argc,argv);
aList=[List create: globalZone];
for (idx=0;idx<30;idx++)
{
coal=[Coalition createBegin: globalZone];
[coal setLength: 8];
coal=[coal createEnd];
[coal randomInit];
[aList addLast: coal];
}
printf("The list contains %d members\n",[aList getCount]);
listIndex=[aList begin: globalZone];
//remove members
while ([listIndex next]!=NULL)
[listIndex remove];
if ([aList getCount]!=0)
printf ("aList unclean! It still contains %d members!\n");
else
printf ("aList perfectly cleaned! Now it contains %d members.\n");
return 0;
}
... and this is the output
aList contains 30 members
aList perfectly cleaned! Now it contains 0 members
Do I have the magic touch or what's behind?
Fabio.
==================================
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.
- Re: what's wrong with this use of the index to clean a list?,
famasce <=