News for hackers. Stuff that matters.
Re:Writing Good C++14 by Default [pdf] by criddell on Wednesday September 23, 2015 @11:00AM (#10265411)
Every time C++ is discussed here, I feel like I might be the only person on the planet that likes C++ and enjoys working in it. I get excited when Sutter publishes an article about some proposed new feature. I enjoy talking about code with new hires and giving them a set of Scott Meyers' books to read. I'm in awe of what the clever Boost contributors wring out of the language.

I don't think it's a stinking ball of meat. It's a living language with a deep history that's getting better all the time. It's a wonderful tool that I use daily.

Re:Writing Good C++14 by Default [pdf] by tonyarkles on Wednesday September 23, 2015 @01:15PM (#10266385)
Let's be friends! I did a lot of C++ back in the late 90s/early 2000s, and it kind of sat on the shelf for me for a while. I've recently come back and am discovering all of the joys of modern C++(11/14). I'm really really impressed. The first project was a cross-platform library on top of libusb. With all of the great concurrency things built-in now (std::thread/mutex/lock, etc), I managed to write the whole library without a single #ifdef! Generates Linux .so, OS X .dylib, and Windows DLLs. Amazing!
Re:Writing Good C++14 by Default [pdf] by CuttlefishXXX on Wednesday September 23, 2015 @05:11PM (#10268268)
>I managed to write the whole library without a single #ifdef! Generates Linux .so, OS X .dylib, and Windows DLLs. Amazing!

Could you expand on how you are doing this? You're still using a Makefile or a similar tool with some kind of platform detection for the build itself, right?

Re:Writing Good C++14 by Default [pdf] by flohofwoe on Wednesday September 23, 2015 @06:41PM (#10268749)
Not sure whether the parent does it like this, but you can use cmake to describe the build, and then (for instance) run cmake --build to build the project in a 'cross-platform' way using the platform's native compiler toolchain, it works the same on Windows, OSX and Linux. I think what the parent meant with 'no #ifdefs' is that the C++11 std lib comes with more modules that make a lot of platform-specific code-paths unnecessary (for instance std::thread, std::atomic for threading, and std::chrono for high-resolution time-measuring).
Re:Writing Good C++14 by Default [pdf] by tonyarkles on Thursday September 24, 2015 @03:34AM (#10270343)
Yup, you nailed it. cmake for handling the builds, and the C++11 stdlib covers every platform-specific thing I needed. The only platform-specific thing I needed to do was point the CMakeLists.txt at the correct libusb (libusb.so, libusb.dylib, libusb.dll). Absolutely beautiful.

Edit: to elaborate a little more about cmake... You can use cmake to generate both Makefiles and Visual Studio build files.

On Windows:

mkdir build; cd build; cmake .. -G "Visual Studio 12 2013"; cmake --build .

On OS X or Linux:

mkdir build; cd build; cmake ..; make

Re:Writing Good C++14 by Default [pdf] by flohofwoe on Wednesday September 23, 2015 @12:20PM (#10265965)
As the old saying goes: "There are languages that everybody complains about, and there are languages that nobody uses" ;)
Re:Writing Good C++14 by Default [pdf] by yeureka on Wednesday September 23, 2015 @01:30PM (#10266486)
You are not alone.

It is my favourite language for large scale and high performance projects.

Re:Writing Good C++14 by Default [pdf] by blub on Thursday September 24, 2015 @11:30AM (#10272165)
I like it too and I'm happy to be using C++11 for software development.

It's mature, standardized, cross-platform and has a good tool & library ecosystem. When it comes to shipping something, I'll take C++ any day over the language that just turned 1.0 or the other one which doesn't have a debugger and can barely optimize. I guess there are those non-sexy languages you use to get stuff done and the ones you blog about.