Question: Static variable initialization

Timo tike64 at gmail.com
Tue Feb 23 18:02:55 UTC 2010


Harald Becker wrote:
> Just a question about initialization of static variables in busybox: Is
> it proved that those variables get initialized to zero even without any
> initializer? In the past I had several troubles with programs on
> different systems relying on this assumption.

I don't know too much about busybox in particular but as nobody else 
have answered...

I would say that it is the responsibility of the compiler toolchain to 
make sure that static, not-explicitly-initialized variables are cleared 
before entry into the 'main'. It is a requirement of the C-language. So, 
if the variables are not cleared, the toolchain is horribly broken.

--

Timo



More information about the busybox mailing list