Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 01 May 2009 15:31:33 +0300
From:      Danny Braniss <danny@cs.huji.ac.il>
To:        Marius Strobl <marius@alchemy.franken.de>
Cc:        Maxim Sobolev <sobomax@freebsd.org>, FreeBSD Hackers <freebsd-hackers@freebsd.org>, Roman Divacky <rdivacky@freebsd.org>, Ed Schouten <ed@freebsd.org>, Christoph Mallon <christoph.mallon@gmx.de>, Warner Losh <imp@freebsd.org>
Subject:   Re: C99: Suggestions for style(9) 
Message-ID:  <E1Lzrtu-0006cn-Pp@kabab.cs.huji.ac.il>
In-Reply-To: <20090501112239.GA23199@alchemy.franken.de> 
References:  <49F4070C.2000108@gmx.de> <20090501112239.GA23199@alchemy.franken.de>

next in thread | previous in thread | raw e-mail | index | archive | help
> 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





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E1Lzrtu-0006cn-Pp>