Re: [PATCH] removal of "static foo = 0" from drivers/ide (test11)

David Hinds
2000-11-28T21:27:47Z

> What information is lost? Unless you're working on a really strange
> machine which does not zero bss, the following means the same from the
> codes point of view:
>
> static int foo = 0;
> static int foo;

I think the argument is that "static int foo;" implies you don't
actually care how "foo" is initialized, but adding the "= 0" is
revealing that the code actually relies on the default value. The
code is obviously equivalent. It is a readability issue, not an issue
of what the code does.

I would contend that it is a compiler bug in gcc if it treats the two
statements differently, since they are trivially equivalent. I guess
that it has been decided that linux kernel coding style dictates no
zero initializers, so that's that. Personally, I prefer symmetry: if
I have a list of static variables initialized to various things, I
don't have to use a different form for ones that are zero initialized.

Did the savings really work out to be measured in kb's of space? I
would have expected compression to eliminate most of the savings.

-- Dave