Re: Coding standards proposal, usage of "this"

Simon Marchi via Gdb-patches
2021-08-16T17:32:22Z

> My 2 cents. I wouldn't mind the change, but having to remember when to use "this" and when not to use it is worse to me than spending a couple minutes trying to figure out why the code is the way it is.

Hmm, I think that when the rule is logical and you know the rationale,
it's pretty obvious when to use it or not. In my original proposal:

- does the identifier name contains something that makes it obvious
it's a member (the m_ prefix)? No need for `this`.
- otherwise? Use `this`.

> I suppose it is just the nature of C++. Some constructs are just not great when trying to read/parse them. I think the same happens with some templates and lambda's. It might take a little bit to figure out where the functions are defined.
>
> Given GDB's code base is a mix of C and C++, wouldn't we risk having yet another mix of new coding standards with old coding standards?

Yes, but in my opinion we shouldn't refrain of adopting new rules and
standards that we find useful because the existing code doesn't follow
the new rule. Otherwise we could never introduce any new rule /
guideline / standards.

Simon