Re: [NEWBIE] Arrays

From: Sean Daley (sdaley@BBNPLANET.COM)
Date: 10/27/98

Well, given that a good portion of circle utilizes linked-lists,
why don't you just do what you have to do as a linked list?
I may be completely missing the point with what you wanted to do,
but it seemed to me that you didn't want to explicitly state how
large your array of structures was going to be.  Problem with
arrays is that at some point you have to give them a set size,
either initially or with one of the *lloc calls at some point.
(someone correct me if I'm wrong on this point).  You'd then
need to keep track of how many bodybags are out there and if
you go over the size of the array, you'd need to re-allocate
enough space for the old array and to handle more entries.

With a linked-list you don't have to state what size you
want.  When a person dies, just add the bodybag to the list
and when they do what they have to get rid of the bodybag,
you remove it from the list.  Actually if I remember right
they're actually some macros in utils.h that handle lists
(I may be wrong on that though).

While not the end all be all of structures, linked-lists
are definitely very useful when trying to do things that
you plan on doing (If I understand what you want correctly!).

Oh well, that's my two cents ...


At 04:02 PM 10/27/1998 -0700, you wrote:
>No. There is quite a difference from what george wrote and what I was
>looking for. I will admit I didn't understand it fully (the create). But
>after taking a look at the code for the create macro there arose to many
>problems that a simple static array would fix. I was looking for an
>answer that did not require me to "explicitly" define the size because I
>didn't really want to put a cap limit on the number of people who can
>die without reclaiming there bodybags and I didn't want to waist memory
>that wasn't used. But I guess I will have to write some clean-up
>procedures based on time of death and time on the mud. I think I even
>did try defining the size of the array "explicity" but it didn't work. I
>must have messed it up somewhere along the line. But thankyou everyone
>for your help.
>        - Matt
>Stephen Wolfe wrote:

     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | |

This archive was generated by hypermail 2b30 : 12/15/00 PST