char assert_buf[];
int assert_buf_len; #ifdef XXX_DEBUG
#define assert(expr, ...) \
do{ \
if ((!(expr))) \
{\
char *str = __FILE__; \
int i; \
for(i=strlen(str);i>=;i--) if(str[i]=='\\'||str[i]=='/') break; \
printf("ASSERTION FAILED (%s) at: %s:%d:: ", #expr, str+i+, __LINE__);\
assert_buf_len = snprintf(assert_buf, sizeof(assert_buf)-, __VA_ARGS__);\
printf("%s\r\n", assert_buf);\
}\
} while ()
#else
#define assert(expr, ...) do{ \
}while()
#endif

一个assert的写法的更多相关文章

  1. Spring MVC 中采用注解方式 Action中跳转到另一个Action的写法

    Spring MVC 中采用注解方式 Action中跳转到另一个Action的写法 在Action中方法的返回值都是字符串行,一般情况是返回某个JSP,如: return "xx" ...

  2. JSP中,EL表达式向session中取出一个attribute和JSP脚本访问session取出一个attribute,写法有何不同?(转自百度知道)

    EL表达式使用起来会更简洁,假如session中有一个属性A(attrA),那么EL和jsp脚本取值的方式如下: EL表达式:${ sessionScope.attrA } JSP脚本:<%=s ...

  3. 在ascx中调用另一个ascx的写法

    using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.We ...

  4. C#去掉字符串最后面的一个标点符号的写法

    keywordHtml = keywordHtml.Remove(keywordHtml.LastIndexOf(','),1);

  5. oracle 单独开始一个事物的写法 。

    SET TRANSACTION NAME 'Update salaries'; SAVEPOINT before_salary_update; UPDATE employees SET salary= ...

  6. Java断言assert

    public class Welcome{ public static void main(String[] args){ assert false; System.out.println(" ...

  7. SQL Server 执行计划操作符详解(1)——断言(Assert)

    前言: 很多很多地方对于语句的优化,一般比较靠谱的回复即使--把执行计划发出来看看.当然那些只看语句就说如何如何改代码,我一直都是拒绝的,因为这种算是纯蒙.根据本人经验,大量的性能问题单纯从语句来看很 ...

  8. 使用xUnit为.net core程序进行单元测试 -- Assert

    第一部分: http://www.cnblogs.com/cgzl/p/8283610.html Assert Assert做什么?Assert基于代码的返回值.对象的最终状态.事件是否发生等情况来评 ...

  9. c++ assert() 使用方法

    assert宏的原型定义在<assert.h>中,其作用是如果它的条件返回错误,则终止程序执行,原型定义: #include <assert.h> void assert( i ...

随机推荐

  1. 腾讯的一道JavaScript面试题

    //题目:分别弹出什么内容? <!-- function test(){ this.a = 1; alert(this); //[object Window] } test(); var t = ...

  2. Tomcat容器虚拟路径设置

    1.[官方文档]在tomcat\conf下server.xml中找到 <Host name="localhost" appBase="webapps" u ...

  3. 获取数据库表详细信息、存储过程、视图、的sql

    select s.[name] + '.' + t.[name] as tablename from sys.tables as t,sys.schemas as s where t.schema_i ...

  4. Jupyter Notebook 27绝技——27 Jupyter Notebook tips, tricks and shortcuts

    转载自:https://www.dataquest.io/blog/jupyter-notebook-tips-tricks-shortcuts/ Jupyter notebook, formerly ...

  5. Java中获取长度length和size的问题

    1.length属性是针对Java中的数组来说的,要求数组的长度可以用其length属性: 2.length()方法是针对字符串来说的,要求一个字符串的长度就要用到它的length()方法: 3.ja ...

  6. CPU的大小端模式

    不同体系结构的CPU,数据在内存中存放的排列顺序是不一样的. 存储器中对数据的存储是以字节(Byte)为基本单位的,因此,字(Word)和半字(Half-Word)在存储器中就有两种次序,分别称为:大 ...

  7. JS 跑马灯

    利用jquery 来实现图片切换.文字转换移动的工具. MSClass 连接 http://www.popub.net/script/MSClass.html Mark 用

  8. 学习asp.net比较完整的流程[转]

    如果你已经有较多的面向对象开发经验,跳过以下这两步: 第一步 掌握一门.NET面向对象语言,C#或VB.NET 我强烈反对在没系统学过一门面向对象(OO)语言的前提下去学ASP.NET. ASP.NE ...

  9. $(document).ready() 与 window.onload 之间的区别

    1.执行时机 window.onload 是网页中所有的元素都加载到浏览器后才执行 $(document).ready() 是dom完全就续就可以调用 例如:如果给一副图片添加点击事件,window. ...

  10. break into Ubuntu System

    This morning, I got a spare machine from of of the labmates. The OS is ubuntu 12.04. I could not log ...