Re: [RFA 19/22] Convert tid_range_parser to class

Tom Tromey
2016-09-30T14:43:30Z

>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

Pedro> Whoops, we ended up duplicating work here.

Oops :) But no big deal.

Pedro> Additional differences compared to yours are:
Pedro> - "bool" instead of "int".
Pedro> - "m_" prefixes.

Aha, the m_ prefix. Cancel that earlier question...

Pedro> Let me know what you think. It's super fine with me to rebase
Pedro> mine on top of yours. Did you have a follow up patch for
Pedro> get_number_or_range too, perhaps?

I don't. How about I just drop my patch? That seems simplest to me.

Pedro> void
Pedro> -init_number_or_range (struct get_number_or_range_state *state,
Pedro> - const char *string)
Pedro> +number_or_range_parser::init (const char *string)
Pedro> {
Pedro> - memset (state, 0, sizeof (*state));
Pedro> - state->string = string;
Pedro> + memset (this, 0, sizeof (*this));

I think it's better to do explicit initialization.
This will bite if this class ever is changed to have a vtable (unlikely
but it's better, IMO, to set a good example).

Tom