Max*_*ers 0 c gcc c-preprocessor
我有以下C代码:
#ifdef _MODE_DEBUG
void program_exit(void){
#else
void program_exit(const unsigned char* fileName, unsigned int lineNumber){
printf("The program was called to terminate early from file \"%s\" line %u", fileName, lineNumber);
#endif
//We have to call cleanup() wherever possible.
arguments_cleanup(void);
exit(1);
}
Run Code Online (Sandbox Code Playgroud)
哪个应该在预编译版本的代码中动态提供一个函数,具体取决于是否定义了_MODE_DEBUG.然而,GCC抱怨它在调用arguments_cleanup之前需要各种令牌.为什么GCC不承认这是一个有效的功能,或者为什么这个无效?
arguments_cleanup(void);
Run Code Online (Sandbox Code Playgroud)
这不是调用函数的正确方法,应该是
arguments_cleanup();
Run Code Online (Sandbox Code Playgroud)
编译器试图解释
arguments_cleanup(void);
Run Code Online (Sandbox Code Playgroud)
作为声明.
| 归档时间: |
|
| 查看次数: |
209 次 |
| 最近记录: |