Parenthesis operator in C. What is the effect in the following code
- by Andre
Hi everyone,
I was playing with a macro to enable/disable traces when I came out with the following code when the macro is disabled:
int main
{
("Hello world");
}
This code is valid and I got the desired effect (nothing happens when the macro is disabled) but I couldn't figure out what exactly is happening. Is the compiler seeing the parenthesis as a "nameless" method declaration?
To make it clearer the code is :
#ifdef TRACE
#define trace printf("%s %d -> ",__FILE__, __LINE__);printf
else
#define trace
#endif
int main
{
trace("Hello world");
}
Thanks in advance.