Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Updated the information about MSVC

...

Code Block
bgColor#FFCCCC
langc
int i1 = 10;  /* definition, external linkage */
static int i2 = 20;  /* definition, internal linkage */
extern int i3 = 30;  /* definition, external linkage */
int i4;  /* tentative definition, external linkage */
static int i5;  /* tentative definition, internal linkage */

int i1;  /* valid tentative definition */
int i2;  /* not valid, linkage disagreement with previous */
int i3;  /* valid tentative definition */
int i4;  /* valid tentative definition */
int i5;  /* not valid, linkage disagreement with previous */

int main(void) {
  /* ... */
}

Implementation Details

Both Microsoft Visual Studio 2003 and Microsoft Visual Studio 2005 compile this noncompliant code example without warning 2008 and later provide warnings for this code at the default warning level (/W3), however earlier versions do not warn even at the highest diagnostic levels. Microsoft Visual Studio 2008 does provide warnings at the default warning level. The  The GCC compiler generates a fatal diagnostic for the conflicting definitions of i2 and i5.

...