From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29381 invoked by alias); 22 Jun 2009 19:26:53 -0000 Received: (qmail 29371 invoked by uid 22791); 22 Jun 2009 19:26:53 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx2.redhat.com (HELO mx2.redhat.com) (66.187.237.31) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 22 Jun 2009 19:26:44 +0000 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n5MJQgxG027862 for ; Mon, 22 Jun 2009 15:26:42 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n5MJQfim021027; Mon, 22 Jun 2009 15:26:41 -0400 Received: from opsy.redhat.com (vpn-13-249.rdu.redhat.com [10.11.13.249]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n5MJQfT5009219; Mon, 22 Jun 2009 15:26:41 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id 49820485B9; Mon, 22 Jun 2009 13:26:40 -0600 (MDT) To: Jan Kratochvil Cc: gdb-patches@sourceware.org Subject: Re: [patch] Accelerate blocks sorting References: <20090622173856.GA6649@host0.dyn.jankratochvil.net> <20090622183526.GA31281@host0.dyn.jankratochvil.net> From: Tom Tromey Reply-To: Tom Tromey Date: Mon, 22 Jun 2009 19:26:00 -0000 In-Reply-To: <20090622183526.GA31281@host0.dyn.jankratochvil.net> (Jan Kratochvil's message of "Mon\, 22 Jun 2009 20\:35\:26 +0200") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-06/txt/msg00576.txt.bz2 >>>>> "Jan" == Jan Kratochvil writes: Jan> + return (BLOCK_START (b) > BLOCK_START (a)) Jan> + - (BLOCK_START (b) < BLOCK_START (a)); Tom> This expression needs parens around it, according to GNU rules. Jan> GNU Coding Standards provides this sample code line: Jan> return ++x + bar (); Jan> Moreover it has no sample code (and found no rules) with `return' Jan> using parens. GDB uses `return' with parens a lot but I find it Jan> a GNU style violation by GDB fixing it along in the patches. Jan> Sure no problem to change it but is there any backing for such parens? Yeah. It isn't the return, but the splitting. >From (info "(standards) Formatting") : Insert extra parentheses so that Emacs will indent the code properly. For example, the following indentation looks nice if you do it by hand, v = rup->ru_utime.tv_sec*1000 + rup->ru_utime.tv_usec/1000 + rup->ru_stime.tv_sec*1000 + rup->ru_stime.tv_usec/1000; but Emacs would alter it. Adding a set of parentheses produces something that looks equally nice, and which Emacs will preserve: v = (rup->ru_utime.tv_sec*1000 + rup->ru_utime.tv_usec/1000 + rup->ru_stime.tv_sec*1000 + rup->ru_stime.tv_usec/1000); And, yes, the GNU style is partly defined as "make it work nicely in Emacs". Tom> I think you don't actually need a cleanup here, as nothing here can Tom> call error. However, if you want to leave it, that is also ok with Tom> me. Jan> I did not notice, still I find the code safer that way. Sounds good. Tom