• pch


    #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
    最怕你一生碌碌无为 还安慰自己平凡可贵
  • 相关阅读:
    表示数值的字符串
    正则表达式匹配
    删除链表中重复的结点
    数值的整数次方
    [CSP-S模拟测试]:大新闻(主席树)
    [CSP-S模拟测试]:密码(AC自动机+DP)
    [CSP-S模拟测试]:壕游戏(费用流)
    [CSP-S模拟测试]:山洞(DP+快速幂)
    [CSP-S模拟测试]:阴阳(容斥+计数+递推)
    [CSP-S模拟测试]:虎(DFS+贪心)
  • 原文地址:https://www.cnblogs.com/fakeCoder/p/5095292.html
Copyright © 2020-2023  润新知