From owner-freebsd-hackers@FreeBSD.ORG Fri May 1 12:31:36 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EA28D1065675 for ; Fri, 1 May 2009 12:31:36 +0000 (UTC) (envelope-from danny@cs.huji.ac.il) Received: from kabab.cs.huji.ac.il (kabab.cs.huji.ac.il [132.65.16.84]) by mx1.freebsd.org (Postfix) with ESMTP id 99FC58FC1C for ; Fri, 1 May 2009 12:31:36 +0000 (UTC) (envelope-from danny@cs.huji.ac.il) Received: from pampa.cs.huji.ac.il ([132.65.80.32]) by kabab.cs.huji.ac.il with esmtp id 1Lzrtu-0006cn-Pp; Fri, 01 May 2009 15:31:34 +0300 X-Mailer: exmh version 2.7.2 01/07/2005 with nmh-1.2 To: Marius Strobl In-reply-to: <20090501112239.GA23199@alchemy.franken.de> References: <49F4070C.2000108@gmx.de> <20090501112239.GA23199@alchemy.franken.de> Comments: In-reply-to Marius Strobl message dated "Fri, 01 May 2009 13:22:39 +0200." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 01 May 2009 15:31:33 +0300 From: Danny Braniss Message-ID: Cc: Maxim Sobolev , FreeBSD Hackers , Roman Divacky , Ed Schouten , Christoph Mallon , Warner Losh Subject: Re: C99: Suggestions for style(9) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 May 2009 12:31:37 -0000 > On Sun, Apr 26, 2009 at 09:02:36AM +0200, Christoph Mallon wrote: > > > > return with parentheses: > > Removed, because it does not improve maintainability in any way. There > > is no source for confusion here, so the rule even contradicts the rule, > > which states not to use redundant parentheses. Maybe, decades ago it was > > just a workaround for a broken compiler, which does not exist anymore. > > FYI, the idea behind this rule is said to be to able to use > a macro return(), f.e. for debugging you then can do: > #define return(x) do { \ > printf("returning from %s with %d\n", __func__, (x)); \ > return (x); \ > } while (0) > > Given the this is a nifty feature and parentheses around the > return value don't hurt maintainability in any way IMO this > rule should stay. short version: not nifty, dirty yes! long version: it's already quiet difficult to read the sources with so many MaCrOs roaming around, but if you change if, return, then, else, switch etc, etc to a macro invocation, there will be a slight discrepancy between the undertsanding of the code and its running effect. btw, what if x is a pointer?, or a quad? or a complex ... my .02$ danny