assert.h

来自「UC Library Extensions UnderC comes wi」· C头文件 代码 · 共 24 行

H
24
字号
// assert.h
// UnderC Development Project, Steve Donovan, 2001
#ifndef __ASSERT_H
#define __ASSERT_H
// 1.2.7 Now uses <stdio.h>, __LINE__, and respects NDEBUG
#include <stdio.h>

#define AS_STR(s) #s

#ifndef NDEBUG
  #define assert(expr)  if (!(expr)) \
           __assert(#expr,__FILE__ ,__LINE__)
#else
 #define assert(expr)
#endif

inline void __assert(char *expr, char* file, int line)
{
   fprintf(stderr,"assertion failed %s %d %s\n",file,line,expr);   
   //exit(-1);
}

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?