I read some error materials to avoid when writing C programs, and I came across the following code:
#include <stdio.h>
void foo(int param)
{
printf("foo is called\n");
printf("%d\n",param);
}
int main()
{
return foo,(1);
}
The code above does not contain errors and warnings (it only shows a warning when -Wall is activated), but when I run a small program, nothing is displayed. The foo function is not called due to the comma delimiter.
My question is: why does the C standard allow such syntax? Should the compiler give an error in this case? In what context can this syntax be used in some real case?
Thanks in advance,
PD: I am using GCC 4.8.3
EDIT:
( , -Wall)