Re: if (blah) ...

From: Ray (ruppertr@SNYCORVA.CORTLAND.EDU)
Date: 08/20/99


On Fri, 20 Aug 1999, Peter Ajamian wrote:

[snip some stuff from dak]

> Yes, I REALLY looked (duh!).  I did a search for the word "free" in the nanny
> function and did not find any instance which seems to correlate with the
> psudocode posted by Chris Proctor.  There are some examples which correlate to
> part of the psudocode, and the example posted by George, but that's about as
> close as it gets.

Okay, this is too much.  IIRC, the pseudo-code was something of the
following sort :

free(blah);
blah=NULL;
if (blah)
 {
  do_something();
 }

The point of contention is that there is nothing in circle code _exactly_
like this even though many people have said that there is.

Well, sorry to bring logic into this argument at such a late stage, but
why would you possibly write code _exactly_ like this?  It makes the if
statement completely useless.  What dak, George, and others whose names
slip my mind right now did point out were examples that might not look
exactly like the code above, but were functionally very similar.  The
point of all this is that C's free() doesn't set pointers to NULL.  So if
you aim to check the NULL-ness of a pointer to see if it's valid, you have
to go through the extra step of setting it to NULL yourself.  Or make a
macro to do both so you don't have to think about it too hard.

Enough.

Ray

ObCircle : This may be obvious to most people, but a newbie circle coder
_needs_ to become familiar with structs.h inside and out.  Heck they need
to be familiar with all of the .h files, but structs in particular.  They
need to know what exactly the macros you see peppered all over the code
are _really_ doing and what exactly the core structures used in the game
consist of.  When I first started playing with circle a while ago, I
muddled around a bit, but it wasn't until I sat down and groked the
fundamental structures that the rest of the code became understandable,
even clear.


     +------------------------------------------------------------+
     | 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