This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Remove some variables in favor of using gdb::optional
- From: Tom Tromey <tom at tromey dot com>
- To: Simon Marchi <simon dot marchi at polymtl dot ca>
- Cc: gdb-patches at sourceware dot org
- Date: Sun, 04 Aug 2019 15:21:26 -0600
- Subject: Re: [PATCH] Remove some variables in favor of using gdb::optional
- References: <20190804201023.25628-1-simon.marchi@polymtl.ca>
>>>>> "Simon" == Simon Marchi <simon.marchi@polymtl.ca> writes:
Simon> While reading that code, I noticed that some variables essentially meant
Simon> whether to consider some other variable or not. I think using
Simon> gdb::optional (which was not available when this code was written) is
Simon> clearer, as it embeds the used/not used predicate directly in the type
Simon> of the variable, making it harder to miss.
Thanks, this looks reasonable to me.
Simon> + /* If set, only look for symbols that match that block. Valid values are
Simon> + GLOBAL_BLOCK and STATIC_BLOCK. */
Simon> + gdb::optional<int> block_index;
I guess optional<block_enum> would be even better here.
Tom