From: Paul Bolle <pebolle@tiscali.nl>
To: Pedro Alves <pedro@codesourcery.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] tui-out: don't "inherit" redirect from CLI
Date: Mon, 30 Aug 2010 11:49:00 -0000 [thread overview]
Message-ID: <1283168942.10594.24.camel@localhost.localdomain> (raw)
In-Reply-To: <201008301229.12412.pedro@codesourcery.com>
On Mon, 2010-08-30 at 12:29 +0100, Pedro Alves wrote:
> That was the main reason that tui_ui_out_impl was made to inherit
> cli_ui_out_impl in the first place.
> See <http://sourceware.org/ml/gdb-patches/2010-04/msg00540.html>.
Missed that one, obviously. (My excuse could be that the commit message
doesn't seem to mention that reason.)
> [...] tui_ui_out_data "inherits" cli_ui_out_data.
> See:
>
> struct tui_ui_out_data
> {
> struct cli_ui_out_data base;
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> int line;
> int start_of_line;
> };
> typedef struct tui_ui_out_data tui_out_data;
>
> "base" is the first field of tui_ui_out_data, so you can
> pass a pointer to a tui_ui_out_data to a function that expects
> a cli_ui_out_data pointer. This is legal, and a common idiom on C,
> as means to implementing "is-a" inheritance.
Thanks for taking the time to explain this to me. Maybe next time I'll
recognize the idiom.
Paul
prev parent reply other threads:[~2010-08-30 11:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-30 9:29 Paul Bolle
2010-08-30 11:29 ` Pedro Alves
2010-08-30 11:49 ` Paul Bolle [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=1283168942.10594.24.camel@localhost.localdomain \
--to=pebolle@tiscali.nl \
--cc=gdb-patches@sourceware.org \
--cc=pedro@codesourcery.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