Re: [PATCH 20/26] gdbserver: make some regcache fields private

Simon Marchi
2023-12-22T03:39:55Z

On 2023-02-28 06:28, Tankut Baris Aktemur via Gdb-patches wrote:
> Some fields of the regcache struct are used for internal state
> tracking. Prevent direct access to them from outside by making them
> private.

This is a good step, but it would be nice to:

- rename private fields to prefix them with `m_`. When accessing
fields that are not prefixed with `m_`, I like to use `this->`,
otherwise it's not obvious what you are acessing. With the prefix
though, I don't think it's necessary, as the naming makes it obvious.
It then makes the code a bit more concise.
- reorder members of the class to be somewhat in standard order. I
don't think we have a strict rule about this, but it's typically:
constructor, destructor, public methods, public fields, private
methods, private fields.

I don't mind if this is done by editing the patches in this series, or
as a change on top, if it's easier.

Simon