From mboxrd@z Thu Jan 1 00:00:00 1970 From: "H. Peter Anvin" Subject: Re: [PATCH 3/3] x86: OLPC: speed up device tree creation during boot (v2) Date: Mon, 15 Nov 2010 09:43:15 -0800 Message-ID: <4CE17133.2050101@zytor.com> References: <20101111214546.4e573cad@queued.net> <20101112002704.50c629e2@queued.net> <20101114095013.GB24206@elte.hu> <4CE0B54E.6000101@zytor.com> <20101115070254.GA25243@elte.hu> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20101115070254.GA25243-X9Un+BFzKDI@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: devicetree-discuss-bounces+gldd-devicetree-discuss=m.gmane.org-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org Errors-To: devicetree-discuss-bounces+gldd-devicetree-discuss=m.gmane.org-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org To: Ingo Molnar Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Milton Miller , Ingo Molnar , Andres Salomon , Thomas Gleixner List-Id: devicetree@vger.kernel.org On 11/14/2010 11:02 PM, Ingo Molnar wrote: > > * H. Peter Anvin wrote: > >> What? What is wrong with static variables in functions? It really doesn't seem >> to be a good idea to make them file-scope if they don't need to be. > > They are very easy to overlook and mix up with regular stack variables and i've seen > (and introduced myself) a number of bugs due to them. > > They also often are used in buggy ways (with SMP not taken into consideration), so > overlooking them during review compounds their negative effects. Putting them in > front of the function isnt a big deal in exchange. > > There are people who never overlook them (like yourself), but my brain is wired up > differently. > However, I have to vehemently object to putting them in a wider scope than is otherwise necessary. I agree that static variables should be used sparsely if at all (there really are vary few uses of them that are valid), but putting them in a larger scope screams "I'm used in more than one function", and that is *not* a good thing. -hpa -- H. Peter Anvin, Intel Open Source Technology Center I work for Intel. I don't speak on their behalf.