Re: Circlemud design issues

From: George (greerga@CIRCLEMUD.ORG)
Date: 04/20/98


On Mon, 20 Apr 1998, James Turner wrote:

>victim = mud_calloc(1, sizeof(CHAR_DATA));
>
>as opposed to
>
>CREATE(victim, 1, CHAR_DATA);
>
>The second is ugglier IMO.  It doesn't behave like a function in two
>respects -- the pointer is modified, and CHAR_DATA isn't valid outside
>of the sizeof().  This is ugliness that can easily be avoided.  As it
>stands, the CREATE macro, strictly looking at its usage, doesn't
>clearly assign pointers or whatnot.  It's ugly.

You forgot to cast the mud_calloc return value away from 'void *'.

Create 'victim' consisting of 1 'struct char_data'.

>> >Not that much unnecessary casting -- it can be hidden with wrapper
>> >functions and thereby ensure type safety.  As for traversing a list
>> >given an arbitrary member, how often is that necessary?
>>
>> You're given a person, find who is in the same room.
>
>If you're given a person, then you can only find the people _after_
>them in a room -- not before.  You still have to refer to
>world[IN_ROOM(ch)].people to get the entire list.

Yes, but you just referenced the list from an arbitrary member using the
world array association.  I believe that qualifies the situation.

As for weak inheritance, bad name for it.  Not a bad idea though, the Linux
kernel uses it, but it doesn't stand out as a real need for CircleMUD.

--
George Greer  -  Me@Null.net   | Genius may have its limitations, but stupidity
http://www.van.ml.org/~greerga | is not thus handicapped. -- Elbert Hubbard


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



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