zoukankan      html  css  js  c++  java
  • NSAssert断言

            //适用于调试代码,当程序执行出错时,程序立即停止,并抛出异常;

            //这是一个宏 --称之为  断言;

            int x = 1;

            NSAssert(x!=0, @"**********************不能为0");

            

            /*

             1: 如上代码,当 !=0时,不会打印上述 不能为0

             2:当 x=0 时,就会打印上述信息,并程序立即抛出异常;

             

             */

    内部实现---------

      

    #define NSAssert(condition, desc, ...)	\
        do {				\
    	__PRAGMA_PUSH_NO_EXTRA_ARG_WARNINGS \
    	if (!(condition)) {		\
    	    [[NSAssertionHandler currentHandler] handleFailureInMethod:_cmd \
    		object:self file:[NSString stringWithUTF8String:__FILE__] \
    	    	lineNumber:__LINE__ description:(desc), ##__VA_ARGS__]; \
    	}				\
            __PRAGMA_POP_NO_EXTRA_ARG_WARNINGS \
        } while(0)
    

      

  • 相关阅读:
    setCookie
    EF getCookie
    EF
    Dapper修改
    Dapper显示
    Dapper上传图片
    Dapper存储过程分页
    Azure Function(.Net Cor框架)读取配置文件
    .Net Core3.1中出现AssemblyInfo特性重复
    YAML配置文件 基础学习
  • 原文地址:https://www.cnblogs.com/cocoajin/p/3119261.html
Copyright © 2011-2022 走看看