Re: style(9) question

From: Garance A Drosehn <gad_at_FreeBSD.org>
Date: Thu, 2 Mar 2006 15:54:53 -0500
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_at_gilead.netel.rpi.edu
Senior Systems Programmer               or   gad_at_FreeBSD.org
Rensselaer Polytechnic Institute;             Troy, NY;  USA
Received on Thu Mar 02 2006 - 19:55:02 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:53 UTC