On 09/08/2016 06:30 PM, David Malcolm wrote:
We have a lot of global state in our code.  Ideally we'd reduce the
amount of such global state, but a prerequisite for sane refactoring
is having automated testing in place to ensure that the refactoring
doesn't break anything.

However, the global state itself makes it hard to write such automated

To break this Catch-22, this patch introduces a class temp_override,
for temporarily assigning a value to a global variable, saving the old
value, and then restoring that old value in a dtor.

        * selftest.h (selftest::temp_override): New class.
When you need it, this is fine.


Reply via email to