原帖由 guozhiyang 于 2011-7-15 14:39 发表 LM3S的库函数的源码在编写的时候经常用到 ASSERT((ulBase == UART0_BASE) || (ulBase == UART1_BASE) |);其中ASSERT在库函数编写的时候为什么起到什么作用。表示一个判断的语句??在LM3S的书籍中并没有发现有 ...
函数原型在StellarisWare_for_EK-LM3S811\driverlib\debug.h
#ifndef __DEBUG_H__ #define __DEBUG_H__
//***************************************************************************** // // Prototype for the function that is called when an invalid argument is passed // to an API. This is only used when doing a DEBUG build. // //***************************************************************************** extern void __error__(char *pcFilename, unsigned long ulLine);
//***************************************************************************** // // The ASSERT macro, which does the actual assertion checking. Typically, this // will be for procedure arguments. // //***************************************************************************** #ifdef DEBUG #define ASSERT(expr) { \ if(!(expr)) \ { \ __error__(__FILE__, __LINE__); \ } \ } #else #define ASSERT(expr) #endif
#endif // __DEBUG_H__ |