#ifdef和#endif

作者在 2013-08-12 17:14:34 发布以下内容

代码:

#ifdef __cplusplus
extern "C"

{
#endif

void abc(int);
#ifdef __cplusplus
}

#endif

预编译宏,如果定义了__cplusplus这个宏,那么代码被展开为
extern "C" {
void abc(int);
}
否则就是
void abc(int);

至于
extern "C" {
void abc(int);
}
意思可能是指声明abc为c风格的外部函数

C/C++ | 阅读 1084 次
文章评论,共0条
游客请输入验证码
文章分类
文章归档
最新评论