On Jul 3, 2009, at 1:06 PM, Steve Christensen wrote:
For the case of a function, if you're deploying on 10.4 but using a
10.5 function, that function will be weak-linked so doing a runtime
check is both faster and more accurate in determining whether a
function exists or not.
Beware that there have been edge cases in the past where a non-NULL
function test will give you a false positive with disastrous results.
It goes like this:
if (FunctionName != NULL) {
FunctionName(x, y, z);
}
FunctionName was SPI on 10.x but (inadvertently) exported, but API on
10.y.
When running on 10.x, your NULL function pointer test will pass, but
this is SPI and isn't supported for use. The signature may have
changed, or the range of valid input values may be a subset of the
supported ones on 10.y.
This is not a theoretical problem, but one which has happened in the
past.
What is the take home lesson here? Test all branches of the code you
write.
Jim
_______________________________________________
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to arch...@mail-archive.com