About "static" in C, how is it implemented by the compiler? -
about "static" in c, how implemented compiler ?
this bloomberg interview question. thoughts ?
[[i'm assuming we're talking static
in context of variables here, because static
functions compile/link-time thing, no run-time implications.]]
in short, it's implementation-specific. compiler free chooses.
typically (but no means exclusively), statics stored in .bss or .data sections of executable image @ fixed locations. has performance advantages, can accessed literal addresses, rather pointer dereferences (as case stack-based variables). part of binary, means initial values automatically mapped memory when executable first loaded; no intialisation routines required.
Comments
Post a Comment