Sun Studio 12: C User's Guide

D.1.6 Disallowed Implicit int and Implicit Function Declarations

6.5.2.2 Function calls

Implicit declarations are no longer allowed in the 1999 C standard as they were in the 1990 C standard. Previous versions of the C compiler issued warning messages about implicit definitions only with -v (verbose). These messages and new additional warnings about implicit definitions, are now issued whenever identifiers are implicitly defined as int or functions.

This change is very likely to be noticed by nearly all users of this compiler because it can lead to a large number of warning messages. Common causes include a failure to include the appropriate system header files that declare functions being used, like printf which needs <stdio.h> included. The 1990 C standard behavior of accepting implicit declarations silently can be restored using -xc99=none.

The C compiler now generates a warning for an implicit function declaration:


example% cat test.c
void main()
{
  printf("Hello, world!\n");
}
example% cc test.c
"test.c", line 3: warning: implicit function declaration: printf
example%