首页 > 其他 > 详细

static inline

时间:2015-04-01 12:46:54      阅读:237      评论:0      收藏:0      [点我收藏+]

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

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 inline

原文:http://www.cnblogs.com/yunxinxi/p/4383431.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!