Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule 5.5 and unused extern declarations
#1
Suppose file f.c contains
Code:
extern int a;
extern int f(int x);
but never defines or references that externally-declared identifiers.
Suppose also that the whole program is constituted by f.c and g.c, where g.c contains
Code:
static int a = 3;
static int f(int x) {
  return x+a;
}
Note that there are no other files in the program and that the program is valid C.
In particular, no compilation unit defines or uses the identifiers declared in f.c.

Is this code violating rule 5.5?
Thanks,

Roberto


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)