Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Mar 2006 15:54:53 -0500
From:      Garance A Drosehn <gad@FreeBSD.org>
To:        Dmitry Pryanishnikov <dmitry@atlantis.dp.ua>
Cc:        freebsd-current@FreeBSD.org
Subject:   Re: style(9) question
Message-ID:  <p0623090ec02cf38b9263@[128.113.24.47]>
In-Reply-To: <20060302105229.P83093@atlantis.atlantis.dp.ua>
References:  <20060302105229.P83093@atlantis.atlantis.dp.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
At 11:06 AM +0200 3/2/06, Dmitry Pryanishnikov wrote:
>Hello!
>
>   I apologize for asking here my question (it should belong to
>-questions, but the most developers are available here, and I
>just hope it won't hurt).  What's the historical reason of the
>following style(9) advise:
>
>    Values in return statements should be enclosed in parentheses.
>
>What's the rationale of this?

Let's say you are debugging a routine which has a dozen different
return statements.  If they all have the form 'return (blah)',
then you can easily #define a return(x) macro which could print
out some debugging information before returning.  Or maybe add
one extra check before returning, in order to catch where some
error-situation first showed up.  (that check might need to
reference other variables inside the routine you are debugging,
in which case the check would have to be done in the routine
itself, and not in some calling routine).

You asked for some rationale, and that is a rationale.  It may
not even be the right rationale.  The fact that I mentioned it
does not mean that I plan to join any debate about it.  What is
in style(9) are recommendations which have *already* been agreed
upon.  We're not going to re-open debate on those recommendations
every time some new person reads the man page.  We cannot afford
the amount of time and energy which would be wasted.

-- 
Garance Alistair Drosehn     =      gad@gilead.netel.rpi.edu
Senior Systems Programmer               or   gad@FreeBSD.org
Rensselaer Polytechnic Institute;             Troy, NY;  USA



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