[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 :)
- Re: [Qemu-devel] [PATCH v6 02/29] tests: Sort .gitignore, (continued)
- [Qemu-devel] [PATCH v6 05/29] numa-test: Use hmp(), Eric Blake, 2017/09/01
- [Qemu-devel] [PATCH v6 04/29] qtest: Don't perform side effects inside assertion, Eric Blake, 2017/09/01
- [Qemu-devel] [PATCH v6 07/29] libqtest: Remove dead qtest_instances variable, Eric Blake, 2017/09/01
- [Qemu-devel] [PATCH v6 10/29] libqtest: Topologically sort functions, Eric Blake, 2017/09/01
- [Qemu-devel] [PATCH v6 09/29] libqtest: Use qemu_strtoul(), Eric Blake, 2017/09/01
- [Qemu-devel] [PATCH v6 06/29] tests: Clean up wait for event, Eric Blake, 2017/09/01
- [Qemu-devel] [PATCH v6 08/29] libqtest: Let socket_send() compute length, Eric Blake, 2017/09/01
- [Qemu-devel] [PATCH v6 11/29] libqtest: Inline qtest_query_target_endianness(), Eric Blake, 2017/09/01