Building for earlier OS X versions : Check for NULL *address* of constants
Building for earlier OS X versions : Check for NULL *address* of constants
- Subject: Building for earlier OS X versions : Check for NULL *address* of constants
- From: Jerry Krinock <email@hidden>
- Date: Sun, 28 Apr 2013 18:59:16 -0700
In Apple's SDK Compatibility Guide > Using SDK-Based Development, it says…
"Check the availability of an external (extern) constant or a notification name by explicitly comparing its address — and not the symbol’s bare name — to NULL or nil."
It also says, regarding C *functions* that "the linker sets the address of unavailable functions to NULL". Do they mean during the linking phase of building, or when the program loads (runtime)?
More importantly, is the following code correct? It looks weird.
NSString* identifier ;
if (&NSWorkspaceApplicationKey != NULL) {
// We are running in Mac OS X 10.6 or later
identifier = <expression using the bare name: NSWorkspaceApplicationKey> ;
}
else {
// We are running in Mac OS X 10.5
identifier = <some other expression> ;
}
Thanks,
Jerry Krinock
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden