Daniel Phillips <phillips@bonn-fries.net> said:
> On Sun, 27 Feb 2000, you wrote:
> > > Is there any reason (apart from making vmlinux and kernel binary
> > > images larger) for explicitly initialising variables with 0 when they
> > > will be placed in the BSS anyway?
> > Long long ago (before 1.0) the kernel didnt zero the BSS. Some legacy
> > of that survives in old assignments - otherwise none
> One *small* reason is that you will get "variable may be used
> uninitialized" warnings from the compiler if the variable is always set
> inside conditionals and it can't be proved that every path hits an
> assignment. So if compiling without warnings is important to you, you
> have to either initialize the variable or suppress the warnings.
No relation to this here: BSS is file scope and local static variables,
what you are saying applies to automatic variables. There probably are a
lot of "static flag = 0;"s around, mostly for documentation purposes.
In any case, I'd recommend checking what the compiler does in such a case
(it places initialized data into the DATA segment here, regardless of
value), then ask the GCC folks nicely to place data items that are
explicitly initialized with 0 into BSS.
-- Dr. Horst H. von Brand mailto:vonbrand@inf.utfsm.cl Departamento de Informatica Fono: +56 32 654431 Universidad Tecnica Federico Santa Maria +56 32 654239 Casilla 110-V, Valparaiso, Chile Fax: +56 32 797513- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Tue Feb 29 2000 - 21:00:19 EST