Reputation: 374
I have the following C code:
#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);
}
Which should dynamically provide only one function in the pre-compiled version of the code,depending on whether _MODE_DEBUG is defined or not. However, GCC complains that it expects all kinds of tokens before calling arguments_cleanup. Why does GCC not recognize this as a valid function, or why is this invalid?
Upvotes: 0
Views: 220
Reputation: 183978
arguments_cleanup(void);
isn't the correct way to call the function, it should be
arguments_cleanup();
The compiler tries to interpret
arguments_cleanup(void);
as a declaration.
Upvotes: 5