Re: Circlemud design issues

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

On Tue, 21 Apr 1998, James Turner wrote:

>> You forgot to cast the mud_calloc return value away from 'void *'.
>There's no need to cast up.  Promotion is automatic.  It's casting
>down (losing information) that you need to be explicit.

It's the warning part that was meant.  You have to do it or a compiler has
every right to warn you about it.  ANSI C++ forbids implicit conversions
from a void * also, not that this is C++, but something to keep in mind
since people do make it C++.  bpl13 will compile under C++ and the cast is
there for a reason.

>No... you're mistaken.  IN_ROOM(ch) returns an offset (as you know),
>not a pointer.  You gave me a character and I returned a list
>containing those in the same room.  Going through the world array
>doesn't enter into the topic being discussed, ie, accessing a list
>from an arbitrary member without any a priori knowledge.

In response to:

>> >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 never said it had to be a pointer, integer, or what.  But I'm still
traversing the list given the arbitrary member.  Drop the 'prior knowledge'
BS, that wasn't a requirement until you were wrong.

>1. Robustness
>2. Stability
>3. Flexibility
>4. Reliability
>5. Predictability (both in structure and in operation)
>Using "weak inheritance" can help achieve all of those.

But you're also increasing complexity all because you want to catch invalid
pointers.  If you remeber to NULL pointers first, or not reuse them, the
problem will not occur.  The Linux kernel uses it when a function can be
passed many different structures and it needs to determine their type.
CircleMUD doesn't need that in anything as of yet. (Unless you want to make
a free() wrapper, but it's quite unncessary.)

> Circle can move forward in two ways.  One is adding features, the
>other is cementing the base more firmly.  One without the other is a

Check out the 486k CircleMUD bpl13 patch some day.

George Greer  -   | Genius may have its limitations, but stupidity | is not thus handicapped. -- Elbert Hubbard

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

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