Grammer discrepancies for external data definitions.

bcase at cup.portal.com bcase at cup.portal.com
Wed Aug 10 11:17:30 AEST 1988


Hi.  I have a question about the necessity of including a type-specifier for
an external data definition (not a function definition).  It seems that the
ANSI C grammer in the back of the new (2nd edition) K & R book doesn't allow
something like

*i;

to stand for

int *i;

In fact, in the "Summary of changes" section in the back of that book, it says:
"External declarations without any specifiers or qualifiers (just a naked
declarator) are fobidden."  Yet it seems that at least some claimed-ANSI C
compilers accept this and do what you might expect (allocate room for an int).
At least one C++ implementation disallows it.  To those of you with the ANSI
spec sitting in front of you, I ask "what is the correct behavior?"



More information about the Comp.lang.c mailing list