static inline

今天看到了这样一段代码,

static inline BOOL IsEmpty(id thing) {

    return thing == nil || [thing isEqual:[NSNull null]]

    || ([thing respondsToSelector:@selector(length)]

        && [(NSData *)thing length] == 0)

    || ([thing respondsToSelector:@selector(count)]

        && [(NSArray *)thing count] == 0);

}

很好奇,查了下,大致意思是

static让变量或者函数(这里是函数)局部可用,inline是让这里的函数代码折叠,调用时直接把代码复制过去,相当于宏定义,不过现在大多不用了

你可能感兴趣的:(static)