On Jun 1, 2007, at 8:20 PM, Steve Peters wrote:
I can't see any need for such a macro other than for the minor
obfuscation
that it allows. For most of the Parrot code, I haven't SET_NULL()
used, and
I haven't used it myself. I'm a bit curious how much it is
actually used.
I know why we have it now. It's there as a shortcut to save us from
having to set pointers to NULL if for some reason NULL is not all zero.
It's usually used like this:
memset( foo, 0, sizeof(*foo));
SET_NULL(foo->pointer);
If we're on a platform where NULL is all zeroes, then SET_NULL()
evaluates to nothing, and we don't expend the extra instructions to
set foo->pointer to NULL, because it already is null. But good golly
how expensive must we think foo->pointer = NULL must be to have to
optimize it away.
PLUS, it's an error if we misuse it as in this case in src/
inter_create.c:
if (Parrot_exec_run)
interp = &interpre;
else
interp = mem_allocate_zeroed_typed(Interp);
SET_NULL(interp->lo_var_ptr);
If we are not using the zeroed memory branch, then we are not setting
interp->lo_var_ptr like we think we are. SET_NULL is relaly
SET_NULL_OR_SO_YOU_THINK_HA_HA_HA.
Now I'm DEFINITELY rmeoving it.
xoxo,
Andy
--
Andy Lester => [EMAIL PROTECTED] => www.petdance.com => AIM:petdance