This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: Handling of structure dereferencing
- From: Daniel Berlin <dan at dberlin dot org>
- To: Andrew Cagney <ac131313 at cygnus dot com>
- Cc: Daniel Jacobowitz <drow at mvista dot com>, Eli Zaretskii <eliz at is dot elta dot co dot il>, <gdb at sources dot redhat dot com>
- Date: Tue, 5 Feb 2002 12:30:41 -0500 (EST)
- Subject: Re: Handling of structure dereferencing
On Thu, 3 Jan 2002, Andrew Cagney wrote:
> > On Thu, Dec 06, 2001 at 09:47:50PM +0200, Eli Zaretskii wrote:
> >
> >> > Date: Thu, 6 Dec 2001 12:07:39 -0500
> >> > From: Daniel Jacobowitz <drow@mvista.com>
> >> >
> >> > Right now, and historically, gdb has accepted things like:
> >> > struct foo {char a} *b, **c, ***d;
> >> >
> >> > (gdb) print b.a
> >> > (gdb) print d->a
>
>
> b->a and b.a are probably commonly used - don't some languages even
> accept both forms? As for ``d.a'', I don't have an opinion - hmm, now
> that I know about it I might just start using it :-(
>
I switch them all the time.
For pointers, i usually start by printing [0] of it, then [0].some
member[0], etc.
I almost never use ->.
Why should I have to care whether the object is really a pointer or not to
be able to print a member?
I only care about printing the member, or else i wouldn't have asked for
it.
Is there some good reason to not allow either to work?
IE is allowing it breaking something else, or preventing something else
from being implemented?
If not, why make it *harder* for users to do what they want?
I don't want to have to remember whether in the expression "a.x.d.b.c",
whether b is a poiner or not. I only care about seeing c.
If this is changed, it would, at least for me (and i imagine a large
number
of others) make gdb a lot harder to use.
--Dan