On Tue, 11 Mar 2008, Nicholas Clark wrote: > On Mon, Feb 11, 2008 at 05:48:54PM +0200, Peter Gibbs wrote:
> > There are two apparent solutions: check all notnull arguments before > > calling the functions or remove the nonnull attribute where it is not > > true. > > Or assert() every single one. Which is what Perl 5 does now: > > http://public.activestate.com/cgi-bin/perlbrowse/p/33291 > (And, in my opinion, the only way to be confident that function annotations > aren't introducing bugs along with the optimisations, (sort of) throwing the > anti-baby out with the anti-bathwater. Or whatever the correct opposite of > the cliché is) Yup. Been there, done that. See [perl #49316] AutoReply: [PATCH] Fix 45 test failures with a 1-line patch! And just today, trying to debug a memory pool problem in headers.c, I ran into the same problem. pool was NULL, even though it has the NOTNULL decoration. Of course, it's not supposed to be NULL, but I couldn't trap that case because gcc optimized away all my NULL checks. I had to strip the decoration, rebuild, and then I could put in if (!pool) checks. This was a case where the annotation was correct -- pool wasn't supposed to be NULL -- but it made it harder to debug. -- Andy Dougherty [EMAIL PROTECTED]