2

我有几个inline staticC 函数。我将 Objective-C 代码称为包括[-release].

问题是我必须编译 ARC 或非 ARC 目标的代码。所以我认为我需要通过预定义的编译器标志进行条件编译。我应该为此使用什么标志?

4

1 回答 1

2

来自http://lists.apple.com/archives/xcode-users/2011/Aug/msg00252.html

LLVM 编译器的检查称为__has_feature. ARC 是您可以检查的功能之一。

#ifndef __has_feature
// not LLVM Compiler
#define __has_feature(x) 0
#endif

#if __has_feature(objc_arc)
// compiling with ARC
#else
// compiling without ARC
#endif
于 2012-01-15T19:53:23.270 回答