【发布时间】:2012-05-02 23:43:24
【问题描述】:
查看NS_INLINE 的定义,似乎使用它比static inline 的优势是编译器兼容性,对吗?在 Objective-c 项目中的 c 函数上是否应该始终使用 NS_INLINE 而不是 static inline?
#if !defined(NS_INLINE)
#if defined(__GNUC__)
#define NS_INLINE static __inline__ __attribute__((always_inline))
#elif defined(__MWERKS__) || defined(__cplusplus)
#define NS_INLINE static inline
#elif defined(_MSC_VER)
#define NS_INLINE static __inline
#elif TARGET_OS_WIN32
#define NS_INLINE static __inline__
#endif
#endif
【问题讨论】:
标签: objective-c cocoa static inline