Is #define banned in industry standards?

前端 未结 13 2836
长发绾君心
长发绾君心 2020-12-23 18:52

I am a first year computer science student and my professor said #define is banned in the industry standards along with #if, #ifdef, <

13条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-23 19:26

    If you want your C code to interoperate with C++ code, you will want to declare your externally visible symbols, such as function declarations, in the extern "C" namespace. This is often done using conditional compilation:

    #ifdef __cplusplus
    extern "C" {
    #endif
    
    /* C header file body */
    
    #ifdef __cplusplus
    }
    #endif
    

提交回复
热议问题