Cast to a struct in expressions
Eli Zaretskii
eliz@is.elta.co.il
Fri Apr 27 10:41:00 GMT 2001
> From: Daniel Berlin <dan@cgsoftware.com>
> Date: 27 Apr 2001 11:23:55 -0400
>
> > A parse error in expression, near `long foo; unsigned bar} *)foobar
> >
> > Seems like the parser chokes on the struct declaration?
> Yes.
> > Am I missing something?
> Yes, I think. The parser only handles expressions, nothing more.
> This is why it's c-exp.y, and not c.y.
> :)
>
> If you have a real struct already defined, of course, and di
>
> p/x *(sturct foostruct *)foobar
>
> then *that* should work.
No, there's no such struct, otherwise I wouldn't be opting for this
complication ;-)
I'm still missing something, because I don't see how "*(struct foo *)x"
differs from "*(struct {long foo; unsigned bar;} *)x". Both are valid
C expression syntax, so the parser should be able to parse them both.
I guess someone just stopped short of making this part of the parser,
because it looks like "struct <name>" is the only syntax it accepts.
Right?
Anyway, thanks for the feedback.
More information about the Gdb
mailing list