From: Chris Moller <cmoller@redhat.com>
To: tromey@redhat.com
Cc: gdb-patches@sourceware.org
Subject: Re: PR9167 Derived class static member CRTP infinite recursion on print
Date: Wed, 21 Apr 2010 18:48:00 -0000 [thread overview]
Message-ID: <4BCF4870.8070706@redhat.com> (raw)
In-Reply-To: <m3y6giezcs.fsf@fleche.redhat.com>
On 04/20/10 14:46, Tom Tromey wrote:
>>>>>> "Chris" == Chris Moller<cmoller@redhat.com> writes:
>>>>>>
>
> Chris> You can't do that. obstack_base() returns a pointer to the current
> Chris> allocation, which may change depending on what's stuffed into the
> Chris> obstack--by the time the obstack_free is hit, the base may have
> Chris> changed.
>
> Why do we need to pop the stack at all?
> It seems to me that if we printed something once, during a given call
> into val_print, then we should never try to print it again.
> Am I missing something?
>
You need the pop in situations like:
class A
{
// whatever
};
class B
{
static A a1[] = ...;
static A a2[] = ...;
};
B b;
In this example, printing a1 of 'b' will stick class A on the stack--if
you don't pop the stack, a2 won't be printed at all. What the stack
does is record, at each stack level, what's been printed. In this case,
without the use of the stack, printing the members of a1 would print A,
which would print the members of a1, which would print A,...
prev parent reply other threads:[~2010-04-21 18:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-16 3:48 Chris Moller
2010-04-20 19:00 ` Tom Tromey
2010-04-21 17:35 ` Chris Moller
2010-04-21 18:48 ` Chris Moller [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=4BCF4870.8070706@redhat.com \
--to=cmoller@redhat.com \
--cc=gdb-patches@sourceware.org \
--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