|
| From: | Rik |
| Subject: | [Octave-bug-tracker] [bug #59192] unwind_protect objects should be replaced with lighter weight alternatives |
| Date: | Mon, 28 Sep 2020 19:17:35 -0400 (EDT) |
| User-agent: | Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko |
Follow-up Comment #14, bug #59192 (project octave):
Thanks for tackling graphics.cc; there are 19 instances in that file. I tried
the patch and it doesn't seem to cause any problems for me (I ran the tests
and demos in the plot directory).
One thought, in a replacement like this
- octave::unwind_protect frame;
- frame.protect_var (updating_axes_layout);
- updating_axes_layout = true;
+ octave::unwind_protect_var<bool>
+ restore_updating_axes_layout (updating_axes_layout, true);
would it be simpler to call the instance "restore_var"? The code would then
become
+ octave::unwind_protect_var<bool>
+ restore_var (updating_axes_layout, true);
which is shorter and it is clear which variable is being saved because one can
read across in English and see "restore variable updating_axes_layout".
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?59192>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
| [Prev in Thread] | Current Thread | [Next in Thread] |