[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v1 00/59] trivial unneeded labels cleanup

From: Daniel Henrique Barboza
Subject: Re: [PATCH v1 00/59] trivial unneeded labels cleanup
Date: Thu, 9 Jan 2020 16:19:05 -0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.3.1

On 1/7/20 4:06 AM, Philippe Mathieu-Daudé wrote:
On 1/7/20 7:16 AM, Kevin Wolf wrote:
Am 06.01.2020 um 21:35 hat Daniel Henrique Barboza geschrieben:
On 1/6/20 4:54 PM, Corey Minyard wrote:
On Mon, Jan 06, 2020 at 03:23:26PM -0300, Daniel Henrique Barboza wrote:

Which is cleaner and requires less brain cycles to wonder
whether the 'cleanup' label does anything special, such
as a heap memory cleanup.

I would disagree with this analysis.  To me, I often wonder
when I have to add cleanup code to a routine whether there is
some hidden return in the middle of the function.  That's a lot
harder to spot than just looking for the cleanup label at the
end of the function to see what it does.  For non-trivial
functions I prefer to have one point of return at the end
(and maybe some minor checks with returns right at the beginning).
I'm not adamant about this, just my opinion.

It depends on the case, but yes, I had similar thoughts, at least when
we're talking about non-trivial parts of a function. (Very short
functions of just some initial checks returning directly are usually

 From a debugging point of view, and when adding trace-events, it is easier to 
have a single function exit path.

In various functions modified by your patches, we can split big functions in 
smaller ones and avoid the goto label.

Splitting and refactoring big funcitons wasn't the initial idea of this
work, but I see no problems in doing it. Care to point out where did you
see such cases?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]