Node: Global scope and storage, Next: Code density and documentation, Previous: Functions and prototyping, Up: Global specifications
Rationale: when statically linking executables against
libraries, most linker algorithms operate with object file granularity,
not symbol granularity. With only one exported symbol per source file,
the link process has the finest granularity. Hint: track exported
symbols with nm
.
static
)
functions in source files. Hint: hunt unused functions with
gcc -Wunused
.
This is wrong:
|
static const int primes[] = { 2, 3, 5, 7, 11 }; static const struct { char c; void (*handler)(void *); } handlers[] = { { 'h', &left_handler }, { 'j', &up_handler }, { 'k', &down_handler }, { 'l', &right_handler }, { '\0', 0 } }; |