Pie*_*tro 5 c unix macos macros c-preprocessor
我想知道为什么在MacOSX __unix__上没有定义宏.
MacOSX不是BSD UNIX衍生产品吗?
如果我__unix__在代码中定义宏,我可以遇到一些问题吗?
一般来说,在检查当前平台时,我更喜欢做以下事情:
#ifdef __unix__
...
#endif
Run Code Online (Sandbox Code Playgroud)
代替:
#if defined(__unix__) || defined(__APPLE__) || defined(__linux__) || defined(BSD) ...
...
#endif
Run Code Online (Sandbox Code Playgroud)
最好的选择是在一个地方定义我自己的宏吗?例如:
#if defined(__unix__) || defined(__APPLE__) || defined(__linux__) || defined(BSD) ...
#define UNIX_
#endif
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
964 次 |
| 最近记录: |