for a typo, I leave the a
in there. When I went to compile, the compiler reported:
missing a ',' between declaration of 'a' and 'f'
code:
int a
f(void)
{
}
And was very surpresing since I've never get any error message like this and I didn't know I could put a comma there and it just compiled fine(in more than one compiler I tested):
int a,
f(void)
{
}
But of course it wasn't my intention but int f(void){}
instead of. I give a try in another compilers but it didn't worked and reported a syntax error like this (in clang):
error: expected ';' after top level declarator.
My question is: which one is correct? it should or shouldn't compile? what does standard says about that behavior?
I'm not going to use it since it's a bit ugly to put variable and functions split by comma (just like it is for a function prototype). I'm just curious.
EDIT: added void
in function parameter. Actually I wanted to write a function with empty parameters