public inbox for archer@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@codesourcery.com>
To: Phil Muldoon <pmuldoon@redhat.com>
Cc: archer@sourceware.org, Tom Tromey <tromey@redhat.com>
Subject: Re: [python][rfc] Attempt to print the base class if a there is no Python pretty-printer for a derived class.
Date: Fri, 27 Mar 2009 19:25:00 -0000	[thread overview]
Message-ID: <200903271925.45104.pedro@codesourcery.com> (raw)
In-Reply-To: <49CD23C5.1000605@redhat.com>

On Friday 27 March 2009 19:06:45, Phil Muldoon wrote:
> Pedro Alves wrote:
> > On Friday 27 March 2009 17:50:39, Tom Tromey wrote:
> >   
> >> Pedro> Does this do sensible things if class Y has some
> >> Pedro> fields that mask the Base class's ones, when you only have a
> >> Pedro> pretty printer for Base?
> >>
> >> Yeah... it pretty-prints Base, then goes on to print the subclass
> >> fields as usual (perhaps pretty-printing them as well).
> >>     
> >
> > Okay, I was concerned if the pretty printer for Base would
> > access Y::x instead of Base::x
> It is a printer for Base, but that does not mean it will print out the 
> Base values. Take this example:
> 

<snip example>

I'm not sure if you're talking about what I'm talking.  Here's a
simple example without stl mumbo jumbo, but please don't get caught
up with the actual classes being chosen for the example:

class LibVector
{
private:
	char *data;
        int len;  /* length of data buffer in bytes */
};

class MyApplesVector : public LibVector
{
private:
        int len;  /* length of each apple in the vector in fruitlenght
                     units.  They all must have the same length.  */
}

I was asking if the pretty printer for LibVector, when
applied to MyApplesVector, wouldn't mistake MyApplesVector::len
for LibVector::len, which could cause bad things to happen
when accessing data, or printing the length of the generic
LibVector.

-- 
Pedro Alves

      reply	other threads:[~2009-03-27 19:25 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-27 17:05 Phil Muldoon
2009-03-27 17:34 ` Tom Tromey
2009-03-27 17:43   ` Phil Muldoon
2009-03-27 17:47     ` Tom Tromey
2009-03-27 17:46   ` Paul Pluzhnikov
2009-03-27 18:00     ` Tom Tromey
2009-03-27 18:28     ` Phil Muldoon
2009-03-27 17:43 ` Pedro Alves
2009-03-27 17:50   ` Tom Tromey
2009-03-27 18:05     ` Phil Muldoon
2009-03-27 18:05     ` Pedro Alves
2009-03-27 18:36       ` Tom Tromey
2009-03-27 19:08       ` Phil Muldoon
2009-03-27 19:25         ` Pedro Alves [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=200903271925.45104.pedro@codesourcery.com \
    --to=pedro@codesourcery.com \
    --cc=archer@sourceware.org \
    --cc=pmuldoon@redhat.com \
    --cc=tromey@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).