Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [2/3] RFC: merge symbol "ops" and "aclass" fields
Date: Mon, 04 Feb 2013 16:44:00 -0000	[thread overview]
Message-ID: <87sj5c112o.fsf@fleche.redhat.com> (raw)
In-Reply-To: <20130203092001.GD16948@host2.jankratochvil.net> (Jan	Kratochvil's message of "Sun, 3 Feb 2013 10:20:01 +0100")

>>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:

Jan> These three fields could be union.

I suppose, but that complicates the accessors to save a tiny bit of
memory.  It may even be a net loss with the code growth.

Jan> And these accessors could gdb_assert impl->ACLASS.  Currently if
Jan> ACLASS does not match it returns NULL, which would (correctly)
Jan> crash on dereferencing a method but such coding bug would not be
Jan> noticed during accesses like: if (SYMBOL_COMPUTED_OPS (sym) ==
Jan> &dwarf2_loclist_funcs)

I know this code exists, but I find it pretty ugly.  It is "anti OO" in
the sense that it is checking the object class rather than just calling
a method and letting the class handle itself.  Probably I should have
instead made the DWARF "datum" approach use another function vector...

Adding an assertion in the macro would conflict with patch #3, which
checks the various ops unconditionally.

Tom


  reply	other threads:[~2013-02-04 16:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-16 16:09 Tom Tromey
2013-02-03  9:06 ` Jan Kratochvil
2013-02-06 15:40   ` Tom Tromey
2013-02-06 15:52     ` Jan Kratochvil
2013-02-07 18:24       ` Jan Kratochvil
2013-02-03  9:20 ` Jan Kratochvil
2013-02-04 16:44   ` Tom Tromey [this message]
2013-03-14 20:29 ` Tom Tromey
2013-03-20 18:33   ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sj5c112o.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.kratochvil@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox