This is the mail archive of the gcc@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: Converting GCC to compilation with C++


Gabriel Dos Reis wrote:

Templates, overloading and multiple inheritance work for me and
all other programmers I know of or have met.

Well I must say I entirely agree with David Korn that there are real risks, and I find it worrisome that Gaby does not see them. Indeed if we have people around who are C++ advocates and do not see the risks, that's a problem, and likely to lead to difficult to maintain code. For someone to say that they see no problems with MI is frankly quite amazing to me. Now if someone said "I am an expert, I know how to use MI without introducing problems", OK, but that's not what Gaby said above, he said that all the programmers he knows of have no problems with MI. As for overloading, I would be quite impressed if Gaby can reproduce the exact rules from memory, but certainly he may be able to, but to tell me that all the programmers he knows of know these rules precisely is simply not credible (unless he knows very few other C++ programmers).

Note that I would have similar worries for Ada, though it is
probably less likely in Ada than in C++ to "go bananas",
still it's certainly possible. The Ada front end uses a small
subset of Ada, and for example entirely eschews inheritance
and dynamic dispatching and tasking. This is actually automatically
enforced for the most part, since GNAT is linked with only a
very minimal subset of the Ada run-time library, and any uses
of these forbidden features will cause link failures. We also
maintain an extreme discipline in extensively documenting the
code everywhere, a discipline that does not currently exist
for GCC, where uncommented or inadequately commented code
has been introduced in some places.

I would say the coding in gcc at the moment has a reasonable
style, except for the abominably complex conditionals that
people seem quite fearless in writing. In fact this tendency
of people to have no compunction in writing very complex
logic is exactly what makes me worry about letting the C++
folks who are quite fearless when it comes to complex use
of templates and multiple inheritance etc have at it.

I still think that it will be hard to maintain discipline.
In the case of the way C is used in GCC, there is a kind
of community discipline that is imposed which generates
a reasonably uniform and non-obfuscatory style (with the
exception I note above :-)

Probably the next step in taking this discussion past
generalities (including the above) which have characterized
it so far is for someone to propose a detailed set of coding
standards. I am guessing that this is the point at which it
will be impossible to gather a consensus, but perhaps I am
mistaken. Gaby, why don't you take a shot at doing that,
and try to restrain yourself as much as possible in an
attempt to get something that more people might sign up to.

I was asked to do the same, and I could, but my subset
would look far more like C than C++ :-)


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