Uninitialized static int counters?
Michael ODonnell
michael.odonnell at comcast.net
Fri Feb 6 15:09:14 EST 2009
Jarod Wilson wrote:
> Nope, in the kernel, all statics are initialized to zero
Yes. Right. Sheesh, thanks a bunch, guys but I get the CompSci101
stuff (I've *written* compilers and kernels) I just ask questions
like these in public to keep discussion flowing, and I remarked
about that blindly-cranking-the-counter-til-it-wraps situation
because it was, um, remarkable (to me) how b0rken/clumsy it seems.
Jerry Feldman wrote:
> There are rules that govern the compiler and the language.
> There are no special language constructs for the kernel
Heh. AFAIK, nobody's yet hacked GCC to introduce kernel-specific
extensions, but it wouldn't surprise me if it hasn't at least
been proposed. I haven't worked in the 2.6 kernels much (mostly
2.2 and 2.4 - look for my name in the e100 and bonding code, and
once upon a time in the ATI mouse driver) and that static counter
stuff was clumsy enough that I had to at least wonder if (say) all
static data (maybe just in the syscall handlers, for all I knew?)
were now being reinitialized on a per-process basis, or something
else obscure like that.
It doesn't hurt to ask, especially if some good discussion/lore
ends up in the archives as a result...
More information about the gnhlug-discuss
mailing list