On Fri, 24 Feb 2012 at 0:46:35 -0800, Doug Barton wrote: > On 02/23/2012 23:39, Paul Harris wrote: > > If that patch worked, then that looks like undefined behaviour. > > What triggered me to think about the change to logical negation turns > out to be what you could consider "a FreeBSD problem" after all. :) I > know that in some operating systems (and I believe all/most Linux'es?) > NULL is defined to be numeric 0, so equating them is safe to do. FreeBSD > doesn't do that, so it isn't safe. (Please note, I'm not trying to start > a "whose interpretation of the C standard is more correct" fight, I'm > just saying that FreeBSD does it differently than some/many others do.) > > Meanwhile, I tested that change with and without --dont-restore and it > worked as expected in both cases, so that change should go into the > repo.
Which change? Can you send a properly "changeloged" patch? (ie a git patch with a commit message) > On a more general note, if there are any other places where 'foo == 0' > is being used where logical negation is intended, especially when foo > can be null, they should also be fixed. A quick grep of the new code > (minus str*cmp of course) indicated too many places for me to trace the > code paths myself, sorry. But changing this would definitely make the > code more robust. Indeed, and using !foo even reads better. Is there some code checker which could point out those "violations"? -- To unsubscribe, send mail to [email protected].
