From: Andy Lester <[EMAIL PROTECTED]>
Date: Tue, 11 Mar 2008 20:01:07 -0500
On Mar 11, 2008, at 6:12 PM, Geoffrey Broadwell wrote:
> I'm confused here. My understanding of the difference between
> PARROT_ASSERT and the PARROT_ASSERT_POINTER suggestion is that the
> former checks for truth, and the other would check for lack of obvious
> insanity.
A pointer of 0 is always, 100% of the time invalid. Always.
A pointer of 0xdeadbeef has a non-zero chance of being valid and thus
throwing a false positive. We don't get to control what malloc throws
our way.
Although, I guess, we DO get to if we force all our allocations to go
through mem_sys_allocate(), which we are indeed doing. Usually. I
guess we COULD just make mem_sys_allocate() re-malloc if it gets the
magic 0xdeadbeef. Hmmm.
0xdeadbeef is odd, so it doesn't even have word alignment on
byte-addressable machines. So you don't even have to check on most
architectures. True?
-- Bob Rogers
http://rgrjr.dyndns.org/