公告
财富商城
积分规则
提问
发文
2020-05-14 13:32发布
Ridiculous、
What is the difference (if any) between the two following preprocessor control statements.
#if
and
#ifdef
#ifdef FOO
is a shortcut for:
#if defined(FOO)
#if can also be used for other tests or for more complex preprocessor conditions.
#if defined(FOO) || defined(BAR)
You can demonstrate the difference by doing:
#define FOO 0 #if FOO // won't compile this #endif #ifdef FOO // will compile this #endif
#if checks for the value of the symbol, while #ifdef checks the existence of the symbol (regardless of its value).
最多设置5个标签!
is a shortcut for:
#if
can also be used for other tests or for more complex preprocessor conditions.You can demonstrate the difference by doing:
#if
checks for the value of the symbol, while#ifdef
checks the existence of the symbol (regardless of its value).