Re: [PATCH] include/linux/slab.h: new KFREE() macro.

From: Amit Choudhary
Date: Sun Jan 07 2007 - 17:43:35 EST



--- Christoph Hellwig <hch@xxxxxxxxxxxxx> wrote:

> On Sun, Jan 07, 2007 at 12:46:50AM -0800, Amit Choudhary wrote:
> > Well, I am not proposing this as a debugging aid. The idea is about correct programming,
> atleast
> > from my view. Ideally, if you kfree(x), then you should set x to NULL. So, either programmers
> do
> > it themselves or a ready made macro do it for them.
>
> No, you should not. I suspect that's the basic point you're missing.
>
>

Any strong reason why not? x has some value that does not make sense and can create only problems.
And as I explained, it can result in longer code too. So, why keep this value around. Why not
re-initialize it to NULL.

If x should not be re-initialized to NULL, then by the same logic, we should not even initialize
local variables. And all of us know that local variables should be initialized.

I would like to know a good reason as to why x should not be set to NULL.

-Amit


__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/