Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Two or more incompatible declarations of the same function or object that appear in the same program shall be diagnosed because they result in undefined behavior.

The C Standard [ISO/IEC 9899:2011] identifies three distinct situations in which undefined behavior (UB) may arise as a result of incompatible declarations of the same function or object:

...

Code Block
bgColor#ccccff
languagec
/* a.c: */
int x = 0; /* The definition */

/* b.c: */
extern char x; /* Incompatible declaration */
/* butBut no other references to x */

...

Rule

Severity

Likelihood

Remediation Cost

Priority

Level

DCL40-C

lowLow

unlikelyUnlikely

mediumMedium

P2

L3


Related Guidelines

...