Range comprehensions with C++ lazy generators -- Paolo Severini

From a totally unnecessary blog (we beg to differ):

Range comprehensions with C++ lazy generators

by Paolo Severini

From the article:

Lazy evaluation is a powerful tool and a pillar of functional programming; it gives the ability to construct potentially infinite data structures, and increases the performance by avoiding needless calculations ...

... Functional languages like Haskell have the concept of list comprehensions ... In C#, of course, we have LINQ ... It would be nice to have something similar in an eager language like C++ ... now the lazy, resumable generators proposed by N4286 seem perfect for this purpose ... We can use the VS2015 CTP prototype to experiment with this idea ...

CppCon 2014 Quick Game Development with C++11 / C++14--Vittorio Romeo

While we wait for CppCon 2015 in September, we’re featuring videos of some of the 100+ talks from CppCon 2014. Here is today’s feature:

Quick Game Development with C++11 / C++14

by Vittorio Romeo

(watch on YouTube) (watch on Channel 9)

Summary of the talk:

Modern C++ has made game development a much more pleasurable experience. Features such as smart pointers and variadic templates are invaluable in speeding up the development process and in making the code cleaner and more robust. New easy-to-use multimedia libraries such as SFML, SDL and Cinder make dealing with graphics, sounds and input very easy, and work well with modern code principles. This talk guides the audience through the creation of an Arkanoid/Breakout clone in under 200 lines of code, using C++11/C++14 features and idioms. Chronologically sequential code segments, compiled and executed one by one, will show the attendees how a game is created from scratch, slowly becoming a playable product, step by step. The end result will be a small game, completely written in modern C++ code. Topics covered will range from basic graphics programming to entity management and collision detection/response.

Lock-Free Data Structures. The Evolution of a Stack -- Max Khiszinsky

Max Khiszinsky describes in his recent blog article different approaches to develop concurrent containers.

Lock-Free Data Structures. The Evolution of a Stack

by Max Khiszinsky

From the article

Describing the known algorithms would be quite boring, as there would be a lot of [pseudo-]code, plenty of details that are important but quite specific. After all, you can always find them in the references I provide in articles. What I wanted was to tell you an interesting story about exciting things. I wanted to show the development of approaches to designing concurrent containers.

Quick Q: Why does ~shared_ptr amazingly know how to call the right destructor? -- StackOvervflow

Quick A: Because shared_ptr is awesome and remembers the correct deleter to call.

Recently on SO:

Why does incomplete type of smart pointer data member and raw pointer data member have different behavior when their parent destruct?

In the following code:

smart pointer data member pImpl(class Impl) and raw pointer pc(class CAT) all are incomplete data type, there is no definition of these two classes in Widget.h ...

... For the raw pointer data member, its destuctor is not called when widget object is destructed.

While the shared_ptr data member, its destructor has been correctly called.

... Why do shared_ptr data member and raw data member have different behavior when the widget gets destructed?

Interview with Scott Meyers at Yandex -- Coder_CPP

In case you missed the transcript a few days ago on Reddit:

Interview with Scott Meyers at Yandex

by Coder_CPP

From the interview:

... So I don’t think that in ten years everyone will be using managed languages. I think that C++ is going to remain an extremely important language for production use. Simply because if your goal is to get the maximum of performance out of the machine. If that is what is most important to you. I think that even these days the primary competitors are C and C++. Those are pretty much your choices. And C++ is just a much more expressive language. I have to say that I’m not a C programmer. I've never really been a C programmer. But I think that just a simple notion of destructors is so unbelievably powerful, that as a C programmer I would consider moving to C++ just so I could compile and get destructors. And, obviously, there is a lot more? to it than that...

Dive into C++11 - [5] - Game entity management basics

The intended audience for this tutorial/screencast are people who have some experience with C++ in general, and who watched the previous episodes. This episode also teaches the basics of polymorphism and component-based design.

Dive into C++11: Episode 5

by Vittorio Romeo.

From the author: 

I greatly appreciate comments and criticism, and ideas for future videos/tutorials. Feel free to fork/analyze the source code at: https://github.com/SuperV1234/Tutorials You can find the previous episodes here: Playlist

C++ Tail Recursion Using 64-bit variables -- Giovanni Campo

Leveraging the elegance of recursion:

C++ Tail Recursion Using 64-bit variables

by Giovanni Campo

From the article:

Main disadvantage of Recursion in imperative languages is the fact that not always is possible to have tail calls, which means an allocation of the function address (and relative variables, like structs for instance) onto the stack at each call. For deep recursive function this can cause a stack-overflow exception because of a limit to the maximum size of the stack, which is typically less than the size of RAM by quite a few orders of magnitude.

Semaphores are Surprisingly Versatile --Jeff Preshing

An interesting approach on how semaphores could be used in Modern C++ multithreaded programming:

Semaphores are Surprisingly Versatile

by Jeff Preshing

From the article:

In multithreaded programming, it’s important to make threads wait. They must wait for exclusive access to a resource. They must wait when there’s no work available. One way to make threads wait – and put them to sleep inside the kernel, so that they no longer take any CPU time – is with a semaphore.

I used to think semaphores were strange and old-fashioned. They were invented by Edsger Dijkstra back in the early 1960s, before anyone had done much multithreaded programming, or much programming at all, for that matter. I knew that a semaphore could keep track of available units of a resource, or function as a clunky kind of mutex, but that seemed to be about it.

My opinion changed once I realized that, using only semaphores and atomic operations, it’s possible to implement all of the following primitives:

  1. A Lightweight Mutex
  2. A Lightweight Auto-Reset Event Object
  3. A Lightweight Read-Write Lock
  4. Another Solution to the Dining Philosophers Problem
  5. A Lightweight Semaphore With Partial Spinning ...

Refactoring my Qt database code

I spend some time on refactoring my database code in Qt:

Refactoring my Qt database code

by Jens Weller

From the article:

For two days I had the chance to clean up my code and do a little refactoring. One of the results is, that my database code now also uses variadic templates. For some time now, I use Qt as the UI and Database frontend of my applications...

How Much Should You Pay Your Enginners? (Infographic) -- Cheyenne Richards

techsalaryguide15.PNG

We take all published measurements with a grain of salt, but we weight in favor of those based on interview data -- it's more difficult to gather, but far more accurate, than those based on heuristics applied to automated web search queries.

How Much Should You Pay Your Enginners? (Infographic)

by Cheyenne Richards

Hat tip to Kira M. Newman reporting at tech.coFrom Newman's intro:

Today, Startup Compass released the results of a global survey of engineers that provides a wealth of information about startup salaries -- including the highest-paying programming languages.

Published as “How Much Should You Pay Your Engineers?,” the results are based on a study of Startup Compass members plus data pulled from oDesk, Elance, Toptal, Glassdoor, AngelList, and Payscale...

One conclusion from the data, that resonates with C++ hiring managers: There is no oversupply of capable C++ developers.