This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] PR59170 make pretty printers check for singular iterators


On Fri, 16 Dec 2016 14:17:32 +0100, Jonathan Wakely wrote:
> On 16/12/16 14:06 +0100, Jan Kratochvil wrote:
> > 	(gdb) p bb.c.d
> > 	$4 = (D &) @0x601028: {e = 0x601060 <ee>}
> 
> Wat?
> 
> bb.c.d is not a valid expression.
> 
> B::c is a pointer, it should be bb.c->d
> 
> Is it GDB policy to make invalid expressions like that "work"?

Yes, this is a GDB extension from the times of plain C.  In C++ it became
a problem.  That was not the topic of this example for the initial
dereferencing operator.


> I had no idea this even worked, I'd have used bb.c->d.e->i because
> that's the correct expression for accessing that variable.

There was a plan to make the 'compile' project backward compatible with these
confusing GDB universal dot operators.


Jan


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]