> Date: Mon, 7 Oct 2024 13:37:52 -0700
> Cc: gavinsmith0...@gmail.com, bug-texinfo@gnu.org
> From: Per Bothner <p...@bothner.com>
> 
> > That was maybe true 10 or 15 years ago, but is no longer true: C++ got
> > a lot of additional baggage, standard classes and libraries, and is
> > now very different from C.  Converting a non-trivial C program to
> > efficient and easily maintainable C++ is a very large job, which
> > includes refactoring the main data structures and algorithms into the
> > equivalent C++ classes.  Since you are advocating C++ due to its
> > safety, I'm sure you will agree that the entire memory allocation
> > strategy will have to be redesigned and reimplemented to achieve this
> > safety, otherwise why bother at all?
> 
> I think you're making the perfect be the enemy of the good. Converting
> a large C codebase to "good, idiomatic" C++ is a large job.
> But the point is you can do as much or little of such cleanup as you wish.

If we don't convert the code to safe and easily-maintainable C++, then
why bother at all?  The use of a C++ compiler by itself brings you no
advantages whatsoever: code that was unsafe and spaghetti when
compiled as C will keep being unsafe and spaghetti when compiled in
C++.

> > Once again, you can see this in action on the example of GDB, where
> > core parts of the code keep being redesigned and rewritten to this
> > day in significant ways.  That's what conversion to C++ means in
> > practice, and there's no way around that.
> 
> Or you can take the lesson that you make the initial easy step of compiling
> the C code with a C++ compiler, and then you can take your time cleaning up 
> things
> depending on your painpoints, available people/time, and motivation.

That's the worst of all worlds, IMO: we invest the effort, but gain
very little.

> I volunteer to change the Makefile etc and get the codebase compiling
> with C++. This would likely include a bunch of 'extern "C"' declarations
> are needed.  But only if Patrice supports it (since he seems to do most work
> on the texinfo-to-any part), *and* Gavin is at least neutral  But as long as
> Gavin is firmly opposed, I don't think there is much point in continuing the
> discussion.

Right.

Reply via email to