[Geany-Devel] Let's move to C++98 - Re: Lets move to C99
Dimitar Zhekov
dimitar.zhekov at xxxxx
Wed Aug 28 17:08:27 UTC 2013
On Wed, 28 Aug 2013 15:52:17 +0100
Nick Treleaven <nick.treleaven at btinternet.com> wrote:
> >> * Developer enjoyment, productivity & gaining more experience with C++.
> >> (This might be an incentive for e.g. me to spend more time working on
> >> Geany). This has to be offset against those that might need to learn
> >> e.g. RAII.
>
> > Hmmm?..
>
> Time spent for contributors who don't know C++ to learn the parts we
> use. What's the question?
What's the assumption - that harder contribution will actually be
beneficial? Maybe we should throw some C# then, it's modern and
somewhat supported under Linux, and there may be people who want to
learn it. :)
> Assuming we're comparing the same design in C vs templated C++ code, the
> C++ code would normally have an advantage because more code can be
> inlined. It might be at a disadvantage because of code bloat though, but
> the inlining may outweigh that. Are you sure you tested the C++ code
> with full compiler optimization?
With -O2 for gcc, and the standard "Optimize for speed" profile in the
compiler used by our company. If you mean something like -O99, no, I
haven't. The difference insignificant (<= 0.5%), only annoying.
A probable reason is that STL doesn't use realloc(), and has no slice
allocator (though I haven't tested slices explicitly).
> > Note that gcc has a non-standard extension for RAII, which works with
> > the base C types. And Geany compiles with gcc only.
>
> Really? Have you read HACKING?
The non-existent part which lists the supported compilers? :)
(I know, I know: use standard C code only).
--
So it would be something with pointers-and-references,
gchar-and-[S]String, STL-and-GArray/GList (sometimes required by
GLib/GTK), GObjects-and-classes (or no classes? or library classes
only?..), and some words banned... It'll indeed be challenging to
contribute.
About RAII, how can I convice you that the automatic destructors for
global/static and auto objects *only* are not that useful? Perhaps by
the fact that the later languages, Java and C#, use a different model,
more similar to GLib?
As for our own C++ reference counting for pointers - please... One
should not include new essences unless required. Sorry if my english
is unclear, I think Lex will understand and say it better.
If we are to switch, let's at least stick to what scintilla/gtk/*
does, instead of inventing our own "standards" and wheels. And by that,
I mean gradually rewriting Geany with classes. C++ with functions is
like perl with glob() expressions. It'll still be ugly though, with all
the x'-and-x"-s listed above.
--
E-gards: Jimmy
More information about the Devel
mailing list