Rob Landley wrote:
On Tuesday 23 February 2010 12:02:55 Timo wrote:
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.

(Could you tell me where in the C language speci it's required? I checked the c99-draft.html I have and couldn't find it, but that doesn't mean much. It _seems_ like something C99 would require, but I haven't tracked down where yet.)

I have "ISO/IEC 9899:TC3 Committee Draft — Septermber 7, 2007". There "6.7.8 Initialization" paragraph 10 says:

"...
If an object that has static storage duration is not initialized explicitly, 
then:

— if it has pointer type, it is initialized to a null pointer;
— if it has arithmetic type, it is initialized to (positive or unsigned) zero;
..."

Actually, this was the first time I read it in the standard myself...

--

Timo

_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to