[Geany-Devel] Let's move to C++98 - Re: Lets move to C99

Lex Trotman elextr at xxxxx
Thu Aug 29 05:47:36 UTC 2013


Nick, Matthew, Dimitar,

To keep it short, a few comments:

@Nick,

Thinking back on previous conversions from C to C++, those that went
smoothest were the ones that first changed to compiling with the C++
compiler, with minimal changes to the C code.  This means that you are not
having to be unreasonably careful about non-C compatible features like
exceptions.   That also allows smart pointers for resource management
(where an object is needed outside its creation scope) and other useful
features.

On the topic of exceptions, remember many STL operations and "new" can
throw.  Of course only throwing on uncorrectable errors like out of memory
is fine, it just exits the application.  Thats what will happen to a throw
from Scintilla in current Geany, its not something that will be introduced.
 But as resource management moves to RAII, exceptions can be caught and
produce a more user friendly exit such as dumping buffers first.

After Geany compiles with C++, then parts that can benefit from/need more
C++ features can be changed as someone wants/needs to, its not that
everything has to go to multiple inherited virtual templates tomorrow :).

On using gtkmm, personally I think it is *way* better than the C interface
to GTK, but I don't know if it can be mixed with C GTK easily, and changing
*everything at once* would be a big job.

Not sure why the RTTI affects the ABI, things visible in the ABI must be
POD to maintain C compatibility, there are much stricter limitations to
maintaining POD, like no non-trivial constructors etc.

@Dimitar,

IIUC many C++ implementations (and even some C ones) use the same algorithm
as gslice for small objects already, and of course it can't be used for
strings since they are not fixed size.

The global/static/auto version of RAII is fine if you use smart pointers to
objects that have longer lifetimes, the local RAII ensures that the object
is deleted any time it is still owned by a smart pointer declared in the
scope being exited.  If the object is to live on, it will have been passed
to another smart pointer outside the scope.

@Matthew,

The resource engineering points are IMHO the main ones preventing this
happening.  Geany just doesn't have enough resources to do major changes.
 Subtract those who don't like C++ (its a free world, I don't like Vala :)
and the resources are slimmer still.  Irrespective of whether the changes
are made "one file at a time" or "all C to C++ with minimal changes" there
is a significant first step, coding and testing and testing and testing.
 Most of us are very time constrained, unless we find a significant pool of
available resources it is not gonna happen.

We need to organise the resources first, doing things "to attract more
contributors" have so far failed, I wouldn't bet a change like this on
attracting more support (at least in the time the change is happening).

Nick has offered that C++ "might" attract him to contribute more, I "might"
have time at the end of my current contract, unless I get another quickly,
I guess Colomban is out, Matthew? anybody else?

Cheers
Lex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.geany.org/pipermail/devel/attachments/20130829/d2730ed8/attachment.html>


More information about the Devel mailing list