Re: [ Code ] My previous post...

From: Sammy (samedi@DHC.NET)
Date: 07/30/97


On Wed, 30 Jul 1997, David Klasinc wrote:

>  Hm, I didn't notice that before, but ch is not set on NULL upon
> extracting... ? I think it should be... Because I tried to use if to check
> if char is still there, but... *groink* it was there... then I tried to
> get IN_ROOM(ch) and it croaked again... *grumble*

The reason is that the free() function does not necessarily set the
pointer to null.  On some operating systems it will, but there's no
guarantee.  If you want to use null checks for protection, you could
replace free() with FREE():

#define FREE(ptr)       (free((ptr)); (ptr) = NULL:)

Or you could do it the hard way and change free() on all the systems
you're working with.

Sam


     +------------------------------------------------------------+
     | 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/08/00 PST