[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5194F2B7.6080204@ti.com>
Date: Thu, 16 May 2013 10:52:39 -0400
From: Eduardo Valentin <eduardo.valentin@...com>
To: Dan Carpenter <dan.carpenter@...cle.com>
CC: Rob Landley <rob@...dley.net>, <linux-doc@...r.kernel.org>,
<linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Eduardo Valentin <eduardo.valentin@...com>
Subject: Re: [patch] Documentation: allow multiple return statements per function
On 15-05-2013 13:20, Dan Carpenter wrote:
> A surprising number of newbies interpret this section to mean that only
> one return statement is allowed per function. Part of the problem is
> that the "one return statement per function" rule is an actual style
> guideline that people are used to from other projects.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
>
> diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle
> index e00b8f0..7fe0546 100644
> --- a/Documentation/CodingStyle
> +++ b/Documentation/CodingStyle
> @@ -389,7 +389,8 @@ Albeit deprecated by some people, the equivalent of the goto statement is
> used frequently by compilers in form of the unconditional jump instruction.
>
> The goto statement comes in handy when a function exits from multiple
> -locations and some common work such as cleanup has to be done.
> +locations and some common work such as cleanup has to be done. If there is no
> +cleanup needed then just return directly.
Agreed with this rephrasing.
>
> The rationale is:
>
>
Download attachment "signature.asc" of type "application/pgp-signature" (296 bytes)
Powered by blists - more mailing lists