IMHO this is a Code Smell.

If you need the CC in order to print it out for debugging, it's probably
more useful to print the data that led to that CC.

If you want to save the CC, go off somewhere and do something else, and
restore the CC when you get back, that can be buggy and make debugging
difficult.

For me, it's better (where simple enough) to repeat the test that
produced the CC: the code is much clearer.

If the test cannot be reproduced after the "something else", then it's
conceivable that the CC isn't even valid any more, and, of course,
debugging the original setting of that CC is likely to be difficult.

I'd welcome proposals for counter-examples.

Reply via email to