...
The C99 standard requires type identifiers and forbids implicit function declarations. After issuing the diagnostic, an implementation may choose to assume an implicit declaration and continue translation to support existing programs that used this feature.
...
Noncompliant Code Example (implicit int)
C90 Section 6.5.2 allows for the absence of type specifiers in a declaration. In these cases, the type is defined to be that of a signed int
.
...
At least one type specifier shall be given in the declaration specifiers in each declaration, and in the specifier-qualifier list in each
struct
declaration and type name.
This non-compliant noncompliant code example omits the type specifier.
...
Code Block | ||
---|---|---|
| ||
extern int foo; |
...
Noncompliant Code Example (implicit function declaration)
Implicit declaration of functions is not allowed: every function must be explicitly declared before it can be called. In C89, if a function is called without an explicit prototype, the compiler provides an implicit declaration.
...
However, to conform with C99, you must explicitly prototype every function before invoking it. This non-compliant noncompliant example fails to prototype the foo()
function before invoking it in main()
.
...
For more information on function declarations see DCL07-C. Include the appropriate type information in function declarators.
...
Noncompliant Code Example (implicit return type)
Similarly, do not declare a function with implicit return type. If it returns a meaningful integer value, declare it int. If it returns no meaningful value, declare it void.
...