• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Determining OS at Runtime
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Determining OS at Runtime


  • Subject: Re: Determining OS at Runtime
  • From: Jim Correia <email@hidden>
  • Date: Fri, 3 Jul 2009 13:31:54 -0400

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 (email@hidden)

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:
This email sent to email@hidden


References: 
 >Determining OS at Runtime (From: iseecolors <email@hidden>)
 >Re: Determining OS at Runtime (From: Sherm Pendley <email@hidden>)
 >Re: Determining OS at Runtime (From: Steve Christensen <email@hidden>)
 >Re: Determining OS at Runtime (From: Andrew Farmer <email@hidden>)
 >Re: Determining OS at Runtime (From: Steve Christensen <email@hidden>)
 >Re: Determining OS at Runtime (From: Mark Munz <email@hidden>)
 >Re: Determining OS at Runtime (From: Steve Christensen <email@hidden>)

  • Prev by Date: Re: Determining OS at Runtime
  • Next by Date: Movable Document Modal Dialogs
  • Previous by thread: Re: Determining OS at Runtime
  • Next by thread: Inconsistent "double-click to edit" in NSTableView
  • Index(es):
    • Date
    • Thread