Sometimes I like to browse Apple source code to see how the pros do it, and sometimes learn a thing or two. I’m looking now at the header file for NSManagedObjectContext.h, and for their global variables, for say NSManagedObjectContextDidSaveNotification, they declare it like so:
COREDATA_EXTERN NSString * const NSManagedObjectContextDidSaveNotification;
whereas typically it would just be:
extern NSString * const NSManagedObjectContextDidSaveNotification
Cmd+clicking on COREDATA_EXTERN takes me to its definition:
#define COREDATA_EXTERN extern
So COREDATA_EXTERN is just equal to extern, so my question is, why do they not just use extern?
If you check out the CoreDataDefines.h file, you’ll see a few different definitions for COREDATA_EXTERN, such as:
or:
This allows for some platform specific definitions, all contained under a single definition.
Windows goop, that’s funny. What I’d like to know is when you would be compiling core data on a Windows platform….