Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760595AbZKZOxQ (ORCPT ); Thu, 26 Nov 2009 09:53:16 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1760286AbZKZOxP (ORCPT ); Thu, 26 Nov 2009 09:53:15 -0500 Received: from casper.infradead.org ([85.118.1.10]:41532 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754520AbZKZOxO (ORCPT ); Thu, 26 Nov 2009 09:53:14 -0500 Subject: Re: [PATCH RFC] Codingstyle: allow omitting braces for all single statement branches From: Peter Zijlstra To: Uwe =?ISO-8859-1?Q?Kleine-K=F6nig?= Cc: linux-kernel@vger.kernel.org, Junio C Hamano , Randy Dunlap , Teemu Likonen , Jiri Kosina , Dan Carpenter , Martin Olsson , linux-doc@vger.kernel.org, Andrew Morton In-Reply-To: <1259227618-1466-1-git-send-email-u.kleine-koenig@pengutronix.de> References: <1259227618-1466-1-git-send-email-u.kleine-koenig@pengutronix.de> Content-Type: text/plain; charset="UTF-8" Date: Thu, 26 Nov 2009 15:52:59 +0100 Message-ID: <1259247179.31676.112.camel@laptop> Mime-Version: 1.0 X-Mailer: Evolution 2.28.1 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 968 Lines: 39 On Thu, 2009-11-26 at 10:26 +0100, Uwe Kleine-König wrote: > -This does not apply if one branch of a conditional statement is a single > -statement. Use braces in both branches. > - > -if (condition) { > - do_this(); > - do_that(); > -} else { > - otherwise(); > -} > +If not all branches of a conditional statement are single statements you might > +use braces for both branches. > + > + if (condition) { > + do_this(); > + do_that(); > + } else > + otherwise(); > + > +or > + > + if (condition) { > + do_this(); > + do_that(); > + } else { > + otherwise(); > + } > > 3.1: Spaces Andrew recently objected to this pattern, and I tend to agree with him although I might be guilty of a few such cases myself. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/