[Gpsbabel-code] Suggested floor for C++11 features?
Brought to you by:
robertl
From: Robert L. <rob...@gm...> - 2013-01-27 04:07:47
|
TL;DR; what is the oldest C++ that actually matters in the real world? I recently tracked down a bug that was a glorified version of class foo { public: foo() : latitude(0), longitude(0) {} double latitude; double longitude; double altitude; }; The problem is "easy" to see with three members. With several dozen, it's not. No matter how meticulous you are, you're GOING to forget a default initializer somewhere, whether you do it in the ctor or in the initializer. C++0x's N2756 extension, proposed in '08 to formalize work that was popular before this, implements the "obvious" syntax. class foo { public: double latitude = 0; double longitude = 0; double altitude = invalid_alt; }; (Never mind that "double" is the wrong type for alt for now. Work with me on keeping an obvious example.) My read of the http://wiki.apache.org/stdcxx/C%2B%2B0xCompilerSupport is that GCC doesn't support this until 4.7 which was released only last fall and isn't supported at all by MSVC. That's probably too recent to actually require for minor syntactic candy, so I have to ask the question about what parts of C++11 are fair game? Since this is the kind of code I'm about to write a lot of, it's worth bulletproofing it while I'm touching it. N2431, N2437, and a few others have some nice things going for them. I understand that MS is (finally) aggressively tracking the standard language but frankly, I'd rather do builds with a cross Mingw-targeted GCC or LLVM than track their tools and we have extremely little developer activity from MSVC developers in our midst. OS/X ships with a pretty old G++ (4.2) but a pretty new Clang that's aggressively targeting the new language. On OS/X, there's no downfall to simply requiring LLVM as it's part of the native tools. How pervasive is LLVM on systems of active GPSBabel developers? Telling me that you're porting GPSBabel to VMS on Arduino for your commercial project and require defect compatibility with CFront will only get you mocked and derided. Real World votes from people contributing patches count a lot more. How much C++11 can we sensibly take advantage of? |