Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

C9x to disallow implicit int in declarations

3 views
Skip to first unread message

Douglas Gwyn

unread,
Oct 27, 1996, 2:00:00 AM10/27/96
to

One outcome of the recent Toronto meeting of WG14 & X3J11 was an agreement
to disallow implicit int in declarations in the revised standard C9x.
This will be accomplished by removing the empty type specifier list from
the list of type specifiers allowed in a declaration.

Example:
// extern /*int*/ foo(/*int*/ b); // (this declaration not required)
/*int*/ main(/*void*/)
{
register /*int*/ i = foo(0); // implicit declaration: int foo()
return i;
}
/*int*/ foo(z)
// /*int*/ z; // (this declaration not required)
{
return 0;
}

In the above, the /*int*/ markers would have to be replaced by int for the
program to strictly conform to C9x. We expect that most conforming C9x
implementations will continue to accept missing-type-specifier programs and
will interpret them as having implicit "int" type specifiers (after
generating a diagnostic), but that would not be required by the standard.

In the above, the //-commented declarations are optional, and the change so
far agreed upon for C9x would not require them. We expect additional
proposals to require functions to be declared before use (i.e., not
automatically assigned implicit old-style declarations of function returning
int if invoked before any explicit declaration) and to require declarations
for parameters in old-style function definitions (rather than undeclared
parameters being automatically assigned type int). Sentiment in the
standards committee seems to be supportive of these additional changes.

The motivation for these changes is to catch a common class of programming
oversight (failure to declare). It also brings us a step closer to being
able to remove support for old-style function declarations. (The C++ draft
standard has reportedly already gone in this direction.)

I was tasked with bringing the above to the attention of the public; if you
have reasoned feedback on these changes, feel free to post your comments.
I believe some members of the standards committee monitor this newsgroup.
If you need to contact me personally, since I don't generally read this
newsgroup you should send me email (gw...@arl.mil). Formal comments must go
through your "national body" on JTC1/SC22/WG14, e.g. ANSI X3J11 for the USA.


0 new messages