This is explained in the C99 rationale :
New C99 Feature:
In C89, all type specifiers can be omitted from the declaration specifiers in the declaration. In this case, int was implied. The committee decided that the inherent danger of this feature outweighed its convenience, and therefore it was removed. The effect is to guarantee the production of diagnostic data that will understand the additional category of programming error. After issuing the diagnostics, the implementation can select the intended int and continue translating the program to support existing source code that uses this function.
In other words, it is officially removed from the C99 standard, but compilers can still choose to follow this behavior and issue diagnostics like GCC does. For example, view the alert options page for -Wimplicit-int . To have these warnings compiled as errors, use -pedantic-errors or -Werror .
According to @ Anonymous Answer, C ++ 98 contains a similar rule about type specifiers.
7.1.5 / 2
At least one qualifier type is required that is not a cv qualifier in the declaration, unless it declares a constructor, destructor, or conversion function. 80)
80) There is no special provision for decl-specifier-seq that does not have a type specifier or has a type specifier that defines only cv qualifiers. The "implicit int" rule for C is no longer supported.
For example, GCC supports ISO / IEC 14882: 1998 and higher, so it will be a bug, no matter what.
user3920237
source share