
On Fri, Jun 27, 2014, at 12:03 PM, Tavmjong Bah wrote:
Hi,
I noticed a bunch of 'for' loops in Liam's code and that got me wondering about using C++11 in the experimental branch as 'auto' is so much nicer that "std::map<SPDocument*,int>::iterator iter". When can we start using C++11?
I noticed that http://wiki.inkscape.org/wiki/index.php/C%2B%2B11 only shows results for one Window's compiler. Is there a test program we can run? Fedora 20 is using GCC 4.8 and clang 3.4; both support 'auto' (GCC since 4.4).
Well... there are two different issues "start using C++ 11" and "require C++ 11".
We can start using it now. The main question is when to make it a requirement. (I've written lots of production code that compiles both with and without C++ 11 features)
The secondary question is *which* parts of C++ 11 we can require, and which we have to defer. I believe last time I checked things for the day job included versions of gcc had only about 40% C++ 11 coverage. We also will need to take care to differentiate between C++ 11 features that are present versus those that function correctly. :-)
So we'll need to add a chart of which compilers we need to stay compatible with. Then we can cross-reference with the Apache page and quickly update our chart.
For the record my computer is currently stuck with gcc 4.2.1 since the hardware itself (32-bit CPU) is limited to OSX 10.6 and that does not have newer.
BTW, for that type of verbose code as in the iterator you mention the common workflow is to typedef a much simpler phrase. It's also commonly used for several things on that wiki page including std::unique_ptr.