This is the mail archive of the gdb@sourceware.org mailing list for the GDB 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: Will therefore GDB utilize C++ or not?


On 04/04/2012 10:55 PM, Mark Kettenis wrote:
>> From: Tom Tromey <tromey@redhat.com>
>> Date: Wed, 04 Apr 2012 14:47:39 -0600
>>
>>>>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:
>>
>> Jan> To C++ or not to C++? Unfortunately the discussion was here
>> Jan> already before and I am aware several contributors are not welcome
>> Jan> with it, I think it does not need to affect readability of C code
>> Jan> much, there is not enough workforce to rewrite all the GDB code
>> Jan> into C++ style anyway. Still C++ would help a lot, some kinds of
>> Jan> bugs are not solvable without it.
>>
>> I'm strongly in favor of C++ for reasons I'll lay out below.
>
> And my position on this has not changed: I'm strongly against. C++ is
> horrible language that should never have been invented.

Beyond the obvious question of "why is it a horrible language", I'd
like to ask you to consider another approach.

Is it because of some horribly obfuscated C++ code out there you may
have witnessed? You know the type, takes take the OOP concept and
batters it to atoms?  Useless implementation of esoteric template
designs, not because it is needed, but because it was cool?

There is a lot of C++ code that I do not like, but there is also a lot
of C code that sucks too.  I've written some.  We all have, at some point. 
There is some in GDB.

My belief is that you can write clear, concise, efficient code in
any language; similarly, you can write complete rubbish in any
language too.  C++ debates seem to be a fertile garden for this kind
of discussion, but, eventually, I recognized I was criticizing the
implementer/implementation of the project, not the language itself.

So focusing on the language, and not any previous implementations one
might have witnessed, what is acceptable? My approach to the
discussion is C++ is OK, as in a "C with objects" approach.  That may
be too far for you, and not far enough for others.  But it is a point
to defend and/or compromise on.

Personally, I don't think GDB is going to go crazy with variadic
templates, or other concepts I am not totally keen on.  And, I think,
maintainers need a balance of skeptics and champions, to balance this
out. Every line of code that goes into GDB is subject to review --
even by global maintainers themselves.  That's why this discussion is
not opening the flood-gates, but creaking them open a little.  Say
this discussion results in C++ being acceptable.  Every patch still
has to be posted, reviewed and (if not a maintainer) approved.  There
are safeties at every turn.

So, please, if you can write a concise argument, I for one would like
to read it.  Balance is good, but arguments that we cannot challenge,
or defend just lead us to a dead-end.

Cheers,

Phil



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