Ethereal-dev: Re: [ethereal-dev] Patches containing assert statements (& not much else)

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Ben Fowler <wapdev@xxxxxxxxxxxx>
Date: Thu, 20 Apr 2000 08:33:39 +0100
At 11:02 PM 4/19/00, Guy Harris wrote:
> >Why initialize them to a value with all bits set?  NULL is the right
> >value to use here - it's the official "distinguished value" for pointers
> >in C and C++.
>
> In preference to initialising them to an indeterminate bit pattern! I use
> 0 to indicate that pointer has been used and freed. I thought that I was
> following the model in the developer document

If the developer document suggests using -1 for *pointers*, it is in
error, and should be fixed.

In the light of that I was wrong. This excerpt from the doc
      /* Initialize the subtree pointers */
      static gint ett_PROTOABBREV = -1;
is an example of -1 being used to initialise an int to a known unused
value.

I would like a suitable never_used marker (distinct from an unused marker)
to catch attempts to initialise one of these variables twice. If this is not
possible, I will give up on the idea!

Ben

--
Leedsnet - The information resource for Leeds and the West Riding
< URL:http://www.leedsnet.com/mobile/ >