OS X: why does __LP64__ lead to pure virtual functions?

I’m trying to update some I / O Kit code around 2003, and I’m running to something strange: there are a few where the methods are declared pure virtual only if the __LP64__ preprocessor macro is __LP64__ . Example: IOBlockStorageDevice :

 public #ifdef __LP64__ virtual IOReturn getWriteCacheState(bool *enabled) = 0; #else /* !__LP64__ */ virtual IOReturn getWriteCacheState(bool *enabled); /* 10.3.0 */ #endif /* !__LP64__ */ 

In the above example, why force the implementation of getWriteCacheStatus to> = 10.4, but not to 10.3? Is this just a case of “we should have done this before” or is there something deeper that I don’t see (which usually happens).

+4
source share
1 answer

My hunch is that the 32-bit version includes a default implementation to revert to drivers written before the method was introduced. Since there has never been a 64-bit version of OSX that did not enable this method, they do not need to be provided with a backup. I saw similar patterns in other parts of IOKit for new methods that replace legacy methods. An obsolete method exists only in 32-bit mode and by default calls a new method. The new method is purely virtual in 64-bit mode.

+3
source

All Articles