Subject: Re: CVS commit: src/sys/ufs/lfs
To: Tyler Retzlaff <email@example.com>
From: Manuel Bouyer <firstname.lastname@example.org>
Date: 03/19/2006 15:56:52
On Mon, Mar 20, 2006 at 01:17:09AM +1100, Tyler Retzlaff wrote:
> >Then maybe NULL should be defined to something else than 0 on those
> >platforms ? I wonder how much things will break if we have NULL != 0
> >though ...
> my guess is more things would break, just think of all the code that does:
> char * ptr;
> ptr = NULL;
> if (ptr)
> Of course good practice is to compare against NULL (as is documented in
> I was merely presenting it as a way to catch derefs of bad pointers at a
> more convenient time. If I wrote code with this kind of bug I'd want it
> to crash sooner and give me a useful backtrace rather than later and
> possibly a misleading backtrace.
> Even on ARM the early init to NULL would likely be better given it would
> at least die on the next page fault as Ben says it would.
> Anyway, at this point I guess I just shouldn't have made the change.
I agree with your point and I think the change is fine. I'm doing such
things in my code as well, precisely to catch use of uninitialized or
freed pointers (eventually under DIAGNOSTIC for time-critical code).
Manuel Bouyer <email@example.com>
NetBSD: 26 ans d'experience feront toujours la difference