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

Lex Trotman elextr at xxxxx
Thu Aug 29 12:52:55 UTC 2013


Hi Nick,

[...]

>
>  I would even go so far as to say it's silly to not use C++11 since it's
>> such a major improvement over previous C++ versions, in both performance
>>
>
> I'm curious, why does it perform better?


I'm putting words in Matthews mouth here, but things like move semantics
can reduce the need for allocations and copying, but like all such
"performance improvements" it needs to be used a zillion times before it
matters, and well, Geany does few things a zillion times (except inside
Scintilla's rendering code).


>
>
>  and readability/coder-friendliness and it's well supported on current
>> compilers and platforms.
>>
>
> Is it? I hadn't heard that, maybe. But I bet it will cause problems for
> some distro maintainers/builders on LTS distros.
>

Many of the simpler but useful parts of C++11 seem to have been implemented
in many compilers a while ago, and most compilers now seem to be at, or
close to, standards compliance, but as you say LTS systems are not going to
support C++11 for a while yet.  For example gcc 4.6 (the oldest supported
version) does some stuff under the banner of C++0x and I'm happily using
C++11 with gcc 4.7 without problems, a bit behind the 4.9 latest
development version.


>
> Readability is definitely better in C++11 when avoiding iterators and
> using lambdas, but I was kind of hoping we could avoid those ugly cases. I
> wasn't thinking of using the STL heavily, just a few containers like
> string, and perhaps others for any specialized use cases.
>

Sadly, containers means iterators, inevitably, and yes C++03 syntax is
ugly, but you get used to it, and just type it automatically. Pity "auto"
and "for( a: container )" is C++11, oh well.

 [...]

I proposed banning OOP, operator overloading and exceptions in src to make
> it (much?) easier to understand & maintain the code vs idiomatic C++, with
> all its unintuitive bug-prone corner cases (which are still in C++11), see
> my reply to Lex for more info.
>
>
Looking at it again, I'm not sure we mean the same thing by OOP, its a much
abused and overloaded term, could you perhaps explain your meaning?
 Depending on what you mean, banning it is either sensible, or the silliest
idea ever :)


>
>  Maybe rather than bikeshed about it too much, we can wait until someone
>> wants to add a new module, or replace an existing module (I'm looking at
>> you TM!), or some actual use case, at which point we could discuss
>> whether it makes sense to use C++ for it, and since we already use C++
>> for Scintilla, it's not a huge change to use it in another new C++
>> module with respect to the build systems and stuff.
>>
>
> Yes, or maybe convert a core plugin that uses strings a lot, so we get the
> benefit of RAII. I might look into it unless Colomban is against that (even
> for a core plugin).


Good idea, plugins can be written in C++ now, without any changes to Geany
being needed.  Just make sure you don't leak exceptions (unless you mean
to) since they currently mean terminate().

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


More information about the Devel mailing list