This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Coding style question
- From: Richard Henderson <rth at redhat dot com>
- To: Andreas Bauer <baueran at in dot tum dot de>, gcc at gcc dot gnu dot org
- Date: Thu, 26 Sep 2002 11:04:08 -0700
- Subject: Re: Coding style question
- References: <20020926071805.GP6474@kennel>
On Thu, Sep 26, 2002 at 05:18:05PM +1000, Andreas Bauer wrote:
> It was being pointed out to me that you might prefer in patches the
> style (A)
>
> bool
> function (args)
> {
> /* ... */
> return (<condition>);
> }
>
> over (B)
>
> bool
> function (args)
> {
> /* ... */
> if (<condition>)
> return true;
> else
> return false;
> }
I don't think form B is useful. Depending on how complex the
condition is, I might like to have it broken up into
if (cond1)
return false;
if (cond2)
return true;
if (cond3)
return false;
return true;
But you should not do this when simply moving code around.
r~