Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Added ECLAIR among the tools that support this rule.

...

Code Block
bgColor#FFCCCC
langc

extern foo;

Most C90 implementations do not issue a diagnostic for the violation of this C99 constraint. Many C99 translators will continue to treat such declarations as implying the type int.

...

Code Block
bgColor#ccccff
langc

extern int foo;

Noncompliant Code Example (Implicit Function Declaration)

...

Code Block
bgColor#FFCCCC
langc

int main(void) {
  int c = foo();
  printf("%d\n", c);
  return 0;
}

int foo(int a) {
  return a;
}

...

Code Block
bgColor#ccccff
langc

int foo(int);

int main(void) {
  int c = foo(0);
  printf("%d\n", c);
  return 0;
}

int foo(int a) {
  return a;
}

...

Code Block
bgColor#ffcccc
langc

foo(void) {
  return UINT_MAX;
}

int main(void) {
  long long c = foo();
  printf("%lld\n", c);
  return 0;
}

...

Code Block
bgColor#ccccff
langc

unsigned int foo(void) {
  return UINT_MAX;
}

int main(void) {
  long long c = foo();
  printf("%lld\n", c);
  return 0;
}

...

Tool

Version

Checker

Description

Section

GCC

Include Page
GCC_V
GCC_V

 

Section

can detect violations of this rule when the -Wimplicit and -Wreturn-type flags are used

Section

Compass/ROSE

 

 

 

Section

Klocwork

Include Page
Klocwork_V
Klocwork_V
Section

IF_MISS_DECL RETVOID.IMPLICIT

 

Section

LDRA tool suite

Include Page
LDRA_V
LDRA_V
Section

24 D
20 S
326 S

Section

Fully Implemented

Section

ECLAIR

Include Page
ECLAIR_V
ECLAIR_V
Section

decltype

Section

Fully Implemented

Related Vulnerabilities

Search for vulnerabilities resulting from the violation of this rule on the CERT website.

...