qemu-devel
[Top][All Lists]
Advanced

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

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


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH v1 00/59] trivial unneeded labels cleanup
Date: Tue, 7 Jan 2020 08:06:45 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2

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:
Hello,
[...]

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
fine.)

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.




reply via email to

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