This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: FYI: use SYMBOL_SYMTAB accessor
> I'm somewhat on the fence about this, but on balance I think it is a
> good idea to make types that are used in more than one file opaque.
>
> However, in practice this hasn't always helped much. The symbol
> accessors are the worst, as we've discussed before, because many of them
> are polymorphic without any purpose -- so they are both verbose and hard
> to change. In other cases in recent memory, I've wanted to change
> direct accessors to separate assignments from uses; and this requires
> global changes anyway, meaning that the macros didn't really help all
> that much.
Yeah - in retrospect, I think we should have required that for our
types. I like opaque types (for complex types), because it allows
us to control the contents of the data through a well defined API,
and then allows us to easily track its use. Our macros serve this
purpose to a degree, except that we do not automatically catch
mistakes where we access the field directly instead of through
the macros.
Anyway, I don't think it's really all that important for existing
code at the moment. But something perhaps to bear in mind if we
ever create new data structures - to ask ourselves whether the type
should be opaque or not. Or if we revamp our symbol/types data.
--
Joel