Re: [PATCH] removal of "static foo = 0"

Albert D. Cahalan
2000-11-29T02:17:23Z

Russell King writes:
> Albert D. Cahalan writes:

>> It is too late to fix things now. It would have been good to
>> have the compiler put explicitly zeroed data in a segment that
>> isn't shared with non-zero or uninitialized data, so that the
>> uninitialized data could be set to 0xfff00fff to catch bugs.
>> It would take much effort over many years to make that work.
>
> Oh dear, here's that misconception again.
>
> static int a;
>
> isn't a bug.

Alone, it is not.

> It is not "uninitialised data". It is defined to be
> zero. Setting the BSS of any C program to contain non-zero data will
> break it. Fact. The only bug you'll find is the fact that you're
> breaking the C standard.

Oh, bullshit. We break the C standard left and right already.
This is the kernel, and the kernel can initialize BSS any damn
way it feels like initializing it. The kernel isn't ever going
to be standard C.

Choosing an initializer that tends to catch unintended reliance
on zeroed data would be good. Too bad it is too late to fix.

> All variables declared at top-level are initialised. No questions
> asked. And its not a bug to rely on such a fact.

Go back and read the rest of this thread. Examples have been
provided (not by me) of such code leading to latter mistakes.