qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v6 10/29] libqtest: Topologically sort functions


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH v6 10/29] libqtest: Topologically sort functions
Date: Tue, 05 Sep 2017 12:01:56 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)

Thomas Huth <address@hidden> writes:

> On 01.09.2017 20:03, Eric Blake wrote:
>> Put static functions prior to public ones, in part so that
>> improvements to qtest_start() can benefit from the static
>> helpers without needing forward references.  Code motion, with
>> no semantic change.
>> 
>> Signed-off-by: Eric Blake <address@hidden>
>> ---
>>  tests/libqtest.c | 263 
>> +++++++++++++++++++++++++++----------------------------
>>  1 file changed, 131 insertions(+), 132 deletions(-)
[...]
> That's a *lot* of code motion - just to get rid of one forward
> declaration. IMHO getting rid of just one forward declaration does not
> justify this code churn. But if we really, really want to get rid of the
> forward declaration here, it's maybe better to move the
> qtest_init_without_qmp_handshake() and qtest_init() function to the end
> of the file instead?

I've never understood why people hate forward declarations so much.
Just because the compiler needs to see a declaration before any use
doesn't mean a human reader profits from seeing the definition before
any use.  Sometimes the code is easier to understand in top-down order.

For code I maintain, I evaluate code motion proposals strictly on
readability merits, with complete disregard for the number of forward
declarations added or deleted.

I'm very much not maintaining this code, though :)



reply via email to

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