C
chandanlinster
In K&R (page 210, A8), "declaration" is defined to be:
declaration:
declaration-specifiers init-declarators-list(opt);
Later (3rd paragraph), it says that, "empty declarations are not
permitted".
According to the former definition of "declaration" (which specifies
"declarators" as
being optional) "empty declarations" should be permitted.
So i tried out the following program ...
/***************************/
#include <stdio.h>
#include <stdlib.h>
int main(void) {
int;
putchar('\n');
exit(0);
}
/**************************/
.... and compiled it using ...
$cc prog.c -ansi -pedantic
prog.c: In function 'main':
prog.c:5: warning: useless type name in empty declaration
So i got only a warning (not an error).
The final question would be:- "Are declarators(or "identifiers")
optional?
PS: I am using gcc 4.1 on Linux 2.6
declaration:
declaration-specifiers init-declarators-list(opt);
Later (3rd paragraph), it says that, "empty declarations are not
permitted".
According to the former definition of "declaration" (which specifies
"declarators" as
being optional) "empty declarations" should be permitted.
So i tried out the following program ...
/***************************/
#include <stdio.h>
#include <stdlib.h>
int main(void) {
int;
putchar('\n');
exit(0);
}
/**************************/
.... and compiled it using ...
$cc prog.c -ansi -pedantic
prog.c: In function 'main':
prog.c:5: warning: useless type name in empty declaration
So i got only a warning (not an error).
The final question would be:- "Are declarators(or "identifiers")
optional?
PS: I am using gcc 4.1 on Linux 2.6