[lkml]   [2000]   [Nov]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] removal of "static foo = 0"
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. 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.

There is only two places where you come across uninitialised data:

1. memory obtained from outside text, data, bss limit of the program
(ie, malloced memory)
2. if you use auto variables which may be allocated on the stack

All variables declared at top-level are initialised. No questions
asked. And its not a bug to rely on such a fact.
|_____| ------------------------------------------------- ---+---+-
| | Russell King --- ---
| | | | / / |
| +-+-+ --- -+-
/ | THE developer of ARM Linux |+| /|\
/ | | | --- |
+-+-+ ------------------------------------------------- /\\\ |
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

 \ /
  Last update: 2005-03-22 12:47    [W:0.128 / U:0.696 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site