intermediate

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

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...

CppCon 2014 Accept No Visitors--Yuriy Solodkyy

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:

Accept No Visitors

by Yuriy Solodkyy

(watch on YouTube) (watch on Channel 9)

Summary of the talk:

Visitor Design Pattern was an attempt to overcome a limitation of object-oriented languages - inability to retroactively introduce new polymorphic functions. While it was quite efficient in providing extensibility of functions, it was never truly retroactive, easy to teach, use or maintain, and it achieved this at the cost of hindering extensibility of classes, introduction of control inversion and requiring tons of boilerplate code to be written. Visitor Design Pattern is a workaround, not a solution to the problem and in this talk I would like to discuss a more elegant yet as efficient solution in the form of a Match statement. We will look at several use-cases for the Visitor Design Pattern, their encoding using both approaches and ultimately their advantages and disadvantages.

Quick Q: Calling C++ Application Code from C library?

Quick A: You need to create a stub.

Recently on SO:

Calling C++ Application Code from C library?

Folks, Assuming I have a c++ application / library running which implements say

/* Alloc API */
void* my_alloc(int size) {
    return malloc(sizeof(size));
}

This is not under "extern c".

I have a C dynamic library from which I need to call my_alloc, can I directly call that API?

Like,

int test_my_alloc (int size) {
    int *x;

    x = (int*)my_alloc(size);
    if (x == NULL) {
        return 0;
    } else {
        return 1;
    }
}

CppCon 2014 Hardening Your Code--Marshall Clow

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:

Hardening Your Code

by Marshall Clow

(watch on YouTube) (watch on Channel 9)

Summary of the talk:

Ok, you've written some code, and it seems to work. How can you be sure that it works? It's a busy, complicated, dangerous world out there, and software has to work in lots of different environments.

How can you gain confidence about your code? How can you make your code more reliable?

There are a lot of techniques available to developers today; I'll talk about several of them: Unit tests, static analysis, runtime analysis, fuzzing, decoding compiler warnings and probably others.

CppCon 2014 Creative Coding with C++--Andrew Bell

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:

Creative Coding with C++

by Andrew Bell

(watch on YouTube) (watch on Channel 9)

Summary of the talk:

Realtime graphics, computer vision, hardware hacking, and audio synthesis are just a few of the crafts that fall under the banner term of "creative coding". In this session we'll talk about some of the creative projects putting C++ in places you might not expect it - everywhere from the Smithsonian's permanent design collection to robotic Coca-Cola dispensers on California beaches. We'll look at a wide spectrum of projects ranging from those of the "maker" community to commercial work from full-time professionals earning their livings in advertising and design agencies. And finally we'll take a look at how you can use the C++ you already know to jumpstart your own creative coding projects using the open source toolkit Cinder.

CppCon 2014 The Philosophy of Google's C++ Code--Titus Winters

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:

The Philosophy of Google's C++ Code

by Titus Winters

(watch on YouTube) (watch on Channel 9)

Summary of the talk:

The Google C++ Style Guide is a fairly popular guide for C++ coding practices, both at Google and externally, but some of its recommendations often seem dated and have created controversy and perceived tension with more modern C++ In this talk we will focus on the core philosophies underlying that guide, ranging from the common (be consistent) to the unusual (leave an explicit trace for the reader), and debunk the idea that Google's C++ is anything less than modern. We'll discuss how these core ideas inform contentious rules like "No non-const references" and "Don't use exceptions," and how the application of those rules has worked for us in practice, both as developers and reliability engineers (SREs).