Versions Compared

Key

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

...

Code Block
bgColor#FFcccc
languagec
/* in a.c */
extern int i;   /* UB #1415 */

int f(void) {
  return ++i;   /* UB #3437 */
}

/* in b.c */
short i;   /* UB #1415 */

Noncompliant Code Example (Array Declarations)

...

Code Block
bgColor#FFcccc
languagec
/* in a.c */
extern int *a;   /* UB #1415 */

int f(unsigned i, int x) {
  int tmp = a[i];   /* UB #3437: read access */
  a[i] = x;         /* UB #3437: write access*/
  return tmp;
}

/* in b.c */
int a[] = { 1, 2, 3, 4 };   /* UB #1415 */

Noncompliant Code Example (Function Declarations)

...

Code Block
bgColor#FFcccc
languagec
/* in a.c */
extern int f(int a);   /* UB #1415 */

int g(int a) {
  return f(a);   /* UB #3941 */
}

/* in b.c */
long f(long a) {   /* UB #1415 */
  return a * 2;
}

Noncompliant Code Example (Excessively Long Identifiers)

...

Code Block
bgColor#FFcccc
languagec
/* in bash/bashline.h */
extern char* bash_groupname_completion_function(const char*, int);   /* UB #1415 */

/* in a.c */
#include <bashline.h>

void f(const char *s, int i) {
  bash_groupname_completion_function(s, i);   /* UB #3941 */
}

/* in b.c */
int bash_groupname_completion_func;   /* UB #1415 */

Note: The identifier bash_groupname_completion_function referenced here was taken from GNU Bash version 3.2.

...

[Hatton 1995]Section 2.8.3
[ISO/IEC 9899:2011]Section 6.7.6.2, "Array Declarators," and section 6.2.2, "Linkages of Identifiers"