On Apr 11, 2013, at 8:49 AM, Jacek Caban wrote: > On 04/10/13 16:16, Ken Thomases wrote: >> However, Apple's guidance on using weak linking says that you must >> explicitly compare against NULL. They don't quite say that testing the >> symbol as a standalone boolean expression won't work, but they do say that >> using negation (the ! operator) isn't sufficient. >> https://developer.apple.com/library/mac/documentation/developertools/conceptual/cross_development/Using/using.html#//apple_ref/doc/uid/20002000-SW4 >> >> I'm not sure what the rationale is, but I think there's a peculiarity of >> what the compiler thinks it knows versus what the linker actually knows. >> Basically, the compiler figures there's a symbol that will be resolved (or >> cause a link error), so the check can be optimized away somehow. I think. > > Oh, such restriction seem to indicate a broken design of this weak > linking... Following this is fine, through, but perhaps we should use > nil to be sure that NULL override in winnt.h won't confuse the heuristic?
I expect that "nil" is only meaningful in Objective-C code. I'd be surprised if there was anything special about NULL (either Apple's or Wine's), per se, but if you want an alternative that's insulated against any Wine peculiarities, I'd just use a literal "0" (zero). >> Other than that, the patch looks good to me. > > Thanks for the review. Happy to help. -Ken