From: George Greer (
Date: 03/05/01

On Mon, 5 Mar 2001, Peter Ajamian wrote:

>Excuse me?  Unless you're looking at a different CircleMUD source than I
>am (and I'm looking at the the latest CVS revision as of about, oh, 30
>seconds ago) There are several places where NOWHERE, NOBODY, or NOTHING
>is checked in the _stock_ source right before indexing an array with the
>variable that it's checked against.  How can you possibly say that
>someone might not be using them?

Just because the official CircleMUD happens to use an array doesn't mean
someone else hasn't rewritten it to use a linked list with pointers or an
SQL database.

>The facts are that they are used as tests before indexing an array, and
>that it is possible for the variables they're tested against to have a
>negative value and still bypass the test.

room_rnum = { NOWHERE, 0 .. top_of_world }

You should never have a -2, -3, -4, etc.

>>  We don't honestly want '< 0'
>> anywhere.  The mud should use the appropriate NOWHERE/NOTHING/NOBODY
>> constant rather than any negative number.
>And with that you run a sore risk of giving a false sense of security
>with the test while still having the possibility of indexing an array
>with the negative number.

I'd like to know where these negative numbers are coming from, personally.

>Also note that setting up a macro for
>IS_NOWHERE()/IS_NOTHING()/IS_NOBODY() will accomplish the same thing
>with the same ease of portability and allow testing for conditions that
>a simple == NOWHERE/NOTHING/NOBODY can't possibly allow for.

I'd imagine the other interesting value of NOWHERE is NULL.  I think the
simple test does quite well with that.

>> Anyway, I think the technical arguments on this are sparse and won't hold
>> up to much scrutiny.
>Depends who's doing the scrutinizing.

For some reason I envision that as the start of fisticuffs.

>Well, in the past I have seen similar issues lean towards protecting the
>newbie coder from themselves (case-in-point, having a dummy_mob variable
>instead of simply setting it to NULL).  Are you now saying that you will
>change that position?

It's very likely someone forgets about dummy_mob (see the mailing list
asking about the warning), it's very unlikely someone gets a room number
return code of -2 without trying.  That's what NOWHERE is, a marker.

George Greer

   | FAQ: |
   | Archives: |

This archive was generated by hypermail 2b30 : 12/04/01 PST