From owner-freebsd-hackers@FreeBSD.ORG Fri May 1 14:21:11 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 CCDAC106567D; Fri, 1 May 2009 14:21:11 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 891F68FC22; Fri, 1 May 2009 14:21:11 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.2/8.14.1) with ESMTP id n41EKGim042260; Fri, 1 May 2009 08:20:16 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Fri, 01 May 2009 08:20:20 -0600 (MDT) Message-Id: <20090501.082020.698246310.imp@bsdimp.com> To: christoph.mallon@gmx.de From: "M. Warner Losh" In-Reply-To: <49FADEF3.5010106@gmx.de> References: <49F4070C.2000108@gmx.de> <20090501112239.GA23199@alchemy.franken.de> <49FADEF3.5010106@gmx.de> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: sobomax@freebsd.org, freebsd-hackers@freebsd.org, rdivacky@freebsd.org, ed@freebsd.org, marius@alchemy.franken.de 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 14:21:12 -0000 In message: <49FADEF3.5010106@gmx.de> Christoph Mallon writes: : Marius Strobl schrieb: : > 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. : : This is mentioned nowhere in style(9) (in general it is lacking reasons : why something is some way or the other). It has been an example used for the past 15 years at least as to why to do this... I don't know how many people have actually used the ability to do this in code. : Also I consider this as gross abuse: Macro names shall be in all : uppercase, so it is clear that there is a macro at work. Therefore : "return" is not a candidate. So this would violate yet another rule in : style(9) (the original return already violates the no-redundant : parentheses rule). : Also I would not mention __func__: there were objections against using : it in the past (though I, logically, prefer its use). It is a debugging aid, but one of dubious value for a far more fundamental reason: return; will break any macro. Warner