qemu-block
[Top][All Lists]
Advanced

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

Re: [Qemu-block] [Qemu-devel] [PATCH v5 08/13] tests: Rely more on globa


From: Markus Armbruster
Subject: Re: [Qemu-block] [Qemu-devel] [PATCH v5 08/13] tests: Rely more on global_qtest
Date: Thu, 24 Aug 2017 12:09:15 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux)

Paolo Bonzini <address@hidden> writes:

> On 24/08/2017 09:42, Markus Armbruster wrote:
>> 
>> In a language less primitive than C, I'd write it exactly that way, and
>> nobody would complain.  In old, primitive C, I have to write
>> 
>>     global_qtest = A;
>>     do this
>>     do that
>> 
>>     global_qtest = B;
>>     do something
>> 
>>     global_qtest = A;
>>     do more
>> 
>> Why's that so horrible to justify busywork on wrappers?
>
> Because cut-and-paste is a thing. :(

Cut-and-paste cuts both ways (pardon the pun):

    initialize with QTestState A
    frobnicate with QTestState A
    glomnify with QTestState A
    frobnicate with QTestState A
    initialize with QTestState B
    boingboing with QTestState B
    finalize with QTestState A
    finalize with QTestState A

Uh, forgot to frobnicate after boingboing, let me fix that real quick!

    initialize with QTestState A
    frobnicate with QTestState A
    glomnify with QTestState A
    frobnicate with QTestState A
    initialize with QTestState B
    boingboing with QTestState B
    frobnicate with QTestState A
    finalize with QTestState A
    finalize with QTestState A

Spot the pasto.

This hasty paste would simply work with global_qtest.  I'm not claiming
there are cases that are just the opposite.  I'm just challenging your
apparent claim that the long forms help with avoiding or catching
pastos.  Can you explain how they help more than they hurt?

A bit of global state isn't automatically bad.  *Shared* global state is
what gets us into trouble.  Can you point to examples where global_qtest
is shared in ways that aren't 100% trivial?



reply via email to

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