#define kWeakSelf(weakSelf) __weak __typeof(self)weakSelf = self;

#ifndef __OPTIMIZE__#define NSLog(...) NSLog(__VA_ARGS__)#else# define NSLog(...) {}#endif

#ifdef DEBUG

#define NSLog(...) NSLog(__VA_ARGS__)

#else

#define NSLog(...)

#endif

#define SCREEN_FRAME ([UIScreen mainScreen].applicationFrame)

#define SCREEN_WIDTH ([UIScreen mainScreen].bounds.size.width)

#define SCREEN_HEIGHT ([UIScreen mainScreen].bounds.size.height)

 
  1. //已知的一些编译警告类型
  2. -Wincompatible-pointer-types 指针类型不匹配
  3. -Wincomplete-implementation 没有实现已声明的方法
  4. -Wprotocol 没有实现协议的方法
  5. -Wimplicit-function-declaration 尚未声明的函数(通常指c函数)
  6. -Warc-performSelector-leaks 使用performSelector可能会出现泄漏(该警告在xcode4.3.1中没出现过,网上流传说4.2使用performselector:withObject: 就会得到该警告)
  7. -Wdeprecated-declarations 使用了不推荐使用的方法(如[UILabel setFont:(UIFont*)])
  8. -Wunused-variable 含有没有被使用的变量
///
 
///////
  1. #pragma clang diagnostic push
  2. #pragma clang diagnostic ignored "-Wincompatible-pointer-types"
  3. //含警告的代码,如下,btn为UIButton类型的指针
  4. UIView *view = btn;
  5. #pragma clang diagnostic pop
 
 

“-Wincompatible-pointer-types”为警告类型

clang为编译器名,这里也可以替换为GCC

#pragma clang diagnostic ignored后面只能跟一个忽略警告类型

如果需要同时忽略多种警告,需要这样写:

[cpp] view plaincopy

 
  1. #pragma clang diagnostic push
  2. #pragma clang diagnostic ignored "-Wincompatible-pointer-types"
  3. #pragma clang diagnostic ignored "-Wincomplete-implementation"
  4. //含警告的代码,如下,btn为UIButton类型的指针
  5. UIView *view = btn;
  6. #pragma clang diagnostic pop

最新文章

  1. python字符串格式化输出
  2. 【Go语言】集合与文件操作
  3. JQuery-UI Dialog下使用服务器端按钮失效
  4. Android Malware Analysis
  5. 全国DNS汇总
  6. [设计模式] 12 代理模式 proxy
  7. MapReduce原理讲解
  8. c#基础语言编程-按值类型和引用类型传递参数
  9. JQ点击列表显示隐藏
  10. Windows Phone下页面跳转动画的实现
  11. Windows 控制面板调用命令
  12. radio(单选框)反复选中与取消选中
  13. NewLife.Redis基础教程
  14. Java并发编程:Java Thread方法join的简单总结
  15. Django商城项目笔记No.10用户部分-登录接口
  16. BugkuCTF ---游戏过关 writeup
  17. "UX"将会是下一个Buzzword?
  18. android 蓝牙通信编程讲解
  19. L365
  20. diff命令--比较两个文件的命令

热门文章

  1. VS调试网页的localhost
  2. u Calculate e阶乘相加求和问题
  3. js-JavaScript高级程序设计学习笔记2
  4. Hadoop的RPC分析
  5. java时间和日期类型
  6. 【bzoj3675】 Apio2014—序列分割
  7. win7、win8上SaveFileDialog窗口跳不出的问题
  8. Java学习路线图
  9. AngularJs ngChange、ngChecked、ngClick、ngDblclick
  10. Python翻转字符串或者列表的方式