This is the mail archive of the
archer@sourceware.org
mailing list for the Archer project.
Re: Expressions Status and Oustanding Tasks
Tom Tromey wrote:
Sami> As in directly calling operator<< ?
Yeah, stuff like: foo->operator+(5)
Is this really how we intend to support operators? I would much rather
have "print foo + 5" just work correctly. This seems to work now (with
any gdb):
(gdb) list base::operator+
121 base operator+ (base const& o) const // base::operator+
122 { base b; b.foo_ = foo_ + o.foo_; return b; }
(gdb) p a
{_foo = 1; }
(gdb) p b
{_foo = 3; }
(gdb) p a + b
{_foo = 4; }
That seems to work for +, -, *, /. and % (the only ones I quickly
tested). I have yet to write realcpp tests for all the various cases,
but it might be very useful to start by doing this to scope out the work.
Keith