Thomas Huth <th...@redhat.com> 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 <ebl...@redhat.com> >> --- >> 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 :)