C++编译环境下#ifdef __cplusplus extern "C"的功能

#ifdef __cplusplus
extern "C"
{
#endif

    void test(void);

#ifdef __cplusplus
}
#endif

 

如果是C++编译环境,那么test()函数将按C标准进行编译,这是为了兼容C++编译器。


版权声明:本文为Grey_Street原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。