Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031311AbXEDQQu (ORCPT ); Fri, 4 May 2007 12:16:50 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1031320AbXEDQQt (ORCPT ); Fri, 4 May 2007 12:16:49 -0400 Received: from khc.piap.pl ([195.187.100.11]:58597 "EHLO khc.piap.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031311AbXEDQQs (ORCPT ); Fri, 4 May 2007 12:16:48 -0400 To: Jiri Slaby Cc: Oliver Neukum , linux-kernel@vger.kernel.org Subject: Re: [patch]clarification of coding style regarding conditional statements with two branches References: <200705040926.55257.oliver@neukum.org> <463B47AF.4010503@gmail.com> From: Krzysztof Halasa Date: Fri, 04 May 2007 18:16:46 +0200 In-Reply-To: <463B47AF.4010503@gmail.com> (Jiri Slaby's message of "Fri, 04 May 2007 16:48:15 +0200") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 765 Lines: 47 Jiri Slaby writes: > Why, what's wrong with > if (condition) { > do_this(); > do_that(); > } else > otherwise(); > > ? It's more readable/nicer in my eyes than I think so. And it means less lines #. >> +if (condition) { >> + do_this(); >> + do_that(); >> +} else { >> + otherwise(); >> +} Exception: if (x) { if (y) foo1(); else foo2(); } else bar(); The braces after if(x) are needed so nobody thinks it's: if (x) if (y) foo1(); else foo2(); else bar(); -- Krzysztof Halasa - 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/