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

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -