Why does Apple use the special qualifier COREDATA_EXTERN, and not just extern?

Sometimes I like to browse Apple source code to find out how professionals do it, and sometimes to learn something. I look now in the header file for NSManagedObjectContext.h , and for their global variables, for example NSManagedObjectContextDidSaveNotification , they declare it like this:

 COREDATA_EXTERN NSString * const NSManagedObjectContextDidSaveNotification; 

then as usual it will be simple:

 extern NSString * const NSManagedObjectContextDidSaveNotification 

Cmd + clicking COREDATA_EXTERN brings me back to its definition:

 #define COREDATA_EXTERN extern 

So COREDATA_EXTERN just equal to extern , so my question is, why don't they just use extern ?

+4
source share
1 answer

If you look at the CoreDataDefines.h file, you will see several different definitions for COREDATA_EXTERN, for example:

 #ifdef __cplusplus #define COREDATA_EXTERN extern "C" 

or

 #ifdef __cplusplus #define COREDATA_EXTERN extern "C" _NSWINDOWS_DLL_GOOP 

This allows you to use some specific platform definitions, all of which are contained in a single definition.

Windows goop, this is ridiculous. I would like to know when you will compile basic data on a Windows platform ...

+3
source

All Articles