Re: Will therefore GDB utilize C++? Not.

Joel Brobecker
2012-04-06T13:16:39Z

> >I do not recommend that GDB use C++.
>
> I agree 100% on all points. I came to the same conclusions 10 years
> ago. Everything i do now is C, and i only poke with C++ to grab
> something out of it or to reverse engineer.

I wish we would stop discussing about the language itself, and argue
the technical points that the pro-C++ camp were bringing up. There are
a number of issues with GDB's design there were raised, and solutions
involving the use of C++ were proposed. As far as I know, the anti-C++
camp has rejected C++ in general based on general and vague arguments,
rather than argue the specific points that have been brought up. We are
NOT talking about using ALL of C++, we are talking about using
a reasonable subset that would allow us to expand a bit what the language
can do for us.

If the non-discussion continues, we're going to have to make a decision
on how to decide on this issue, and I am afraid that the only fair
way would be for the Global Maintainers to vote. To my knowledge,
we have never resorted to such an extreme approach, but I don't see
a real discussion happening here.

> Most C++ programmers i've seen have this mentality that they don't
> need to know what's "under the hood" such as what some library is
> doing or how inefficient it is.

Please, we're talking about the GDB Maintainers and the few contributors
who actually participate in GDB's development. This argument means
nothing because the only side-effect is that such programers would
be limited in how much they can contribute. But on the other hand,
if we follow your reasoning, they would not be able to contribute
anyway, since using C makes the language too low-level for them.

I will just go out and say it, but I think about half of the active
maintainer, if not more, are in favor of using some features of C++.
And I can tell you right here and now that they are no dummies.

> OTOH, i don't recommend trying to emulate C++ in plain C, or you end
> up with a maintenance disaster like GTK.

And yet, that's exactly what we are doing:
- unit elaboration;
- gdbarch/language dispatching
- exception handling
- use of unions to emulate polymorphism;
- etc, etc, etc.

And frankly, you criticize GTK's design, but it was exactly the design
I was thinking about of emulating if we wanted a more OO approach
without using C++. To my knowledge, KDE is doing very well, and is
written in C++.

So again, the proposal that was put on the table a long time ago
was that some specific features of C++ be used in order to simplify
certain areas of GDB's code. The pro-C++ camps has, in my opinion,
successfully shown how C++ was going to help. The specific arguments,
in my opinion, should be brought up again, and those specific arguments
should be discussed, rather than just discussing generalities about
how horrible C++ is.

> All it requires is a few more short lines of explanatory design
> notes scattered through the code and clarity of thought.

This is almost offensive. If it was that easy, how about you start
sending some patches?

--
Joel