This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA 17/22] Remove make_cleanup_restore_current_uiout


On 2016-09-29 10:05, Tom Tromey wrote:
"Trevor" == Trevor Saunders <tbsaunde@tbsaunde.org> writes:

Trevor> isn't this just scoped_restore<ui_out *> ? why do you need a separate
Trevor> class?

In an earlier thread there was a discussion of not having this cleanup
be over-general -- that is, it was intentionally specific to just
current_uiout.

In that case, may I suggest naming the class scoped_restore_current_uiout?

IIRC, the original comment was that it was not necessary to have a parametrized make_cleanup_restore_uiout, when the only uiout we restore is the current_ui. And I don't think there was a cleanup to restore a generic pointer, so we had to have a specialized cleanup anyway.

Here we have the option to have one less class by using your scoped_restore:

scoped_restore<ui_out *> uiout_restore (&current_uiout, other_uiout);

vs having a specific one:

    scoped_restore_current_uiout uiout_restore;
    current_uiout = other_uiout;

I am ok with both methods, it's not a big deal.

Simon


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]