#ifdef #ifndef使用

#ifdef THREAD_ON
while (TRUE)
#endif

如上没定义THREAD_ON时,是不会跑到while中去的

如上没定义THREAD_ON时,是会跑到else中去的

#ifndef THREAD_ON
else
{
break;////Give cahnce to other Task
}
#endif

#define与#undef的使用

        #define LBA_BIT (9)
#define LBA_SIZE (1<<LBA_BIT)
#undef LBA_BIT
#undef LBA_SIZE
#define LBA_BIT (6)
#define LBA_SIZE (1<<LBA_BIT)

  #undef就是取消一个宏的定义,之后这个宏所定义的就无效;

但是可以重新使用#define进行定义。

上一篇:嵌入式C语言编译器


下一篇:20个热门jQuery的提示和技巧