From: Jim Blandy <jimb@redhat.com>
To: Daniel Jacobowitz <drow@mvista.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: RFA: static cast from base class to derived class
Date: Wed, 21 Aug 2002 10:22:00 -0000 [thread overview]
Message-ID: <vt2r8gs6sry.fsf@zenia.red-bean.com> (raw)
In-Reply-To: <20020821122557.GA19505@nevyn.them.org>
Daniel Jacobowitz <drow@mvista.com> writes:
> I've got a question... what does VALUE_ADDRESS mean in this context?
> If it means what it normally means (ought to mean?), then taking an
> address, subtracting an address, and using it as a pointer doesn't make
> a lot of sense.
>
> Answering my own question - it's dereferencing a pointer to a struct at
> 0. So we'll actually get an address relative to zero, which makes
> everything work out. This looks good to me.
Right --- when casting from a base class to a derived class, we use
search_struct_field to find the offset the base class has in the
derived class by creating an imaginary instance of the derived class
at address zero, finding the base class in that, and then using the
base class subobject's address as the offset of the base class in the
derived class.
I wanted to fix the bug in what we did with that offset; beautifying
the way we produced it wasn't on my agenda. :)
I'll commit this --- thanks.
prev parent reply other threads:[~2002-08-21 17:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-08-20 23:11 Jim Blandy
2002-08-21 5:25 ` Daniel Jacobowitz
2002-08-21 10:22 ` Jim Blandy [this message]
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=vt2r8gs6sry.fsf@zenia.red-bean.com \
--to=jimb@redhat.com \
--cc=drow@mvista.com \
--cc=gdb-patches@sources.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