谁能告诉我这段代码在做什么?
#ifdef TF_UNIT_TEST
/*lint --emacro( (652), TF_STUB) */
#define TF_STUB(fn) __tf_ ## fn
#else
#define TF_STUB(fn) fn
#endif
最佳答案
它根据是否定义了 TF_UNIT_TEST
宏定义了两个不同名称的函数。
主要代码体中的函数将被声明为eg
int TF_STUB(my_function) (int a, int b)
{
}
如果定义了宏,那么该函数将被命名为__tf_my_function
,如果没有定义,那么它将被命名为my_function
。
关于c - 无法解码一段代码及其用途,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17880729/