Re: if (blah) ...

From: Peter Ajamian (pajamian@access1.net)
Date: 08/20/99


George Greer wrote:

> On Thu, 19 Aug 1999, Peter Ajamian wrote:
>
> >Ceartainly there are several places where it frees memory, then sets the pointer
> >to null, but where does it then turn around and base an if statement on the value
> >of the pointer which was just set to null as in the following line from above...?
>
> Well, if you really want to be that anal about it, line 1319 of
> interpreter.c does a 'free_char(d->character); d->character=NULL;' and then
> calls Valid_Name() that traverses the list of descriptors looking at
> GET_NAME(d->character).

Heh, okay, I'll give you that one, and it's an excellent argument to prove that there
are occasions where you set a pointer to null because you know it is going to be
checked (well, I suppose that if it wasn't going to be checked there wouldn't be much
point in setting it to null in the first place).

To be honest I was thinking of the more direct approach as Chris Proctor's psudocode
pointed out, but I'll take the one you pointed out as a good example regaurdless.

Regards,


Peter


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



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