[RFC 2/8] Use classes to represent MI Command instead of structures

Simon Marchi simark@simark.ca
Fri May 3 22:57:00 GMT 2019


On 2019-05-03 6:49 p.m., Simon Marchi wrote:
> On 2019-04-25 3:25 p.m., Tom Tromey wrote:
>> Rather than returning a unique_ptr, I think this could directly return a
>> scoped_restore_tmpl<int>.  Then, if m_suppress_notification is NULL,
>> just use the address of a dummy variable instead.
> 
> Or a gdb::optional?

Oh, just saw that Tom suggested that too:

> Alternatively, if all invoke methods have to start this way, make invoke
> non-virtual and then have it do the setup and then call a virtual
> do_invoke function.  Then invoke can use a gdb::optional<...>.

I think that's a good idea, but do_suppress_notification could return an
optional in any case.

Simon



More information about the Gdb-patches mailing list