This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 6/8] const-fy regcache::m_aspace


On 2017-11-01 05:42, Yao Qi wrote:
Simon Marchi <simon.marchi@ericsson.com> writes:

I don't really understand what this patch tries to achieve.  From the
description above, I thought you wanted to make the m_aspace field const,
not the pointed object.


I want to achieve both, the field m_aspace is a const, and the pointed
object is const too.

   /* The address space of this register cache (for registers where it
      makes sense, like PC or SP).  */
-  struct address_space *m_aspace;
+  const address_space * const m_aspace;

Ah ok I had missed that there was two consts added.

If constifying the pointed address_space object is really what you meant to do, I find having the const_cast more confusing than anything else. I think we should constify all the way (removing const_casts, putting more consts
where needed) or not at all.

OK, const_cast is removed in the updated patch, what do you think?

LGTM!


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]