How to write Portable C/C++/Objective-C++ code to target Apple iPhone/Mac OSX?
I'm working with some C/C++ code that runs on Win32 and also VxWorks. It uses #ifdef WIN32 to switch to platform specific implementations.
I've been using the c开发者_开发技巧ode on the iPhone and I want to update it and keep it as portable as possible, but I'm not sure what's the best practice. So far I've been using #ifdef __APPLE__ blocks.
What should I be using to target Apple iPhone and Mac OS X?
- Is
#ifdef __APPLE__the best approach? - Are there any gotchas to be aware of?
You might look at __IPHONE_OS_VERSION_MIN_REQUIRED to partition code for different versions of iOS. You might also look at partitioning based on CPU, e.g. between 32- and 64-bit Intel apps.
加载中,请稍侯......
精彩评论