[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4CE5670B.1060300@zytor.com>
Date: Thu, 18 Nov 2010 09:48:59 -0800
From: "H. Peter Anvin" <hpa@...or.com>
To: Andres Salomon <dilinger@...ued.net>
CC: michael@...erman.id.au, Ingo Molnar <mingo@...e.hu>,
devicetree-discuss@...ts.ozlabs.org, linux-kernel@...r.kernel.org,
Milton Miller <miltonm@....com>,
Ingo Molnar <mingo@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH 3/3] x86: OLPC: speed up device tree creation during boot
(v2)
On 11/18/2010 09:41 AM, Andres Salomon wrote:
>>
>> No, sorry, this sounds like a personal preference that is well out of
>> line with the vast majority of C programmers I've ever come across,
>> not just in the Linux kernel world but outside of it.
>
>
> This is actually one of the reasons I specifically like initialized
> static variables (inside of functions). Take the following code:
>
> int foo(void)
> {
> static char *frob = NULL;
> int p;
>
> if (frob) {
> ...
> }
>
>
> Upon seeing that and thinking "whoa, how could frob be
> initialized and then checked?", I realize that it's either a bug or I
> look back at the initialization and realize that frob is static. It's
> less obvious (to me) with non-explicit initialization.
I have to agree with this one. In general I dislike relying on an
implicit (even well-defined) initialized value; unfortunately we ripped
out explicit initializations across the Linux kernel, not due to
readability but due to the fact that long-since-obsolete versions of gcc
would put explicitly-initialized variables in data rather than bss even
if the initial value is zero.
-hpa
--
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel. I don't speak on their behalf.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists