This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Move GDB to C++ ?
>>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes:
Eli> So will someone please tell, loud and clear: what do we want to do the
Eli> day after GDB is rewritten in C++? Let's suppose that we magically
Eli> fast-forward to the day after everything was refactored and GDB is
Eli> 110% pure, OO, C++ -- what will we do the next day that we cannot or
Eli> have difficulties doing today?
Nobody is proposing that we stop all work and rewrite GDB in C++, then
look to see what we could do with it. That would not make sense.
Aside from the one-time effort to make gdb compile with a C++
compiler, it can be introduced gradually.
C++ is not a silver bullet, it is an improvement.
I think much of Ian's PDF on moving GCC to C++ applies just as well to
gdb:
http://www.airs.com/ian/cxx-slides.pdf
Actually, the case is even stronger for gdb. For example, GCC does
not use RAII or exceptions -- both idioms where C++ is strong -- but
gdb does.
Naturally, every construct in C++ can be written using C. This is
obvious, because gdb already does it. However, in C++ it is generally
less work, and the result is often better -- more regular, simpler to
reason about, more type-safe, less buggy, or in some cases faster.
Tom