December 2013

C++ User Group Meetings in December

Well, December brings a few more meetings of C++ User Groups this year:

C++ User Group Meetings in December

From the article:

This December feels a bit special, as my own user group was founded 2 years ago. We'll celebrate with cake and a C++ quiz! Also, a few other C++ User Groups do meet:

    11.12 C++ User Group San Francisco/Bay Area
    12.12 C++ User Group San Antonio -- 2 talks
    12.12 C++ User Group London
    12.12 C++ User Group Dresden -- virtual inheritance & CRTP
    17.12 C++ User Group Berlin -- the C++11 Memory Model
    18.12 C++ User Group Düsseldorf -- 2 years! We'll have cake and a C++ quiz!

C++Now 2014: 3 Days to Submissions Deadline

Only 3 days left before the submissions deadline for C++Now 2014!

C++Now is a general C++ conference for C++ experts and enthusiasts. It is not specific to any library/framework or compiler vendor and has three tracks with presentations ranging from hands-on, practical tutorials to advanced C++ design and development techniques. For more information about C++Now, see the conference's website.

Have you learned something interesting about C++ (e.g., a new technique possible in C++11)? Or maybe you have implemented something cool related to C++ (e.g., a C++ library)? If so, consider sharing it with other C++ enthusiasts by giving a talk at C++Now 2014. For more information on possible topics, formats, etc., see the call for submissions.

Say hello to wxWidgets3.0

A few weeks ago wxWidgets3.0 was released, now it's time to take a look at it:

Say hello to wxWidgets3.0

From the Article

I remember the times, when wxWidgets 3.0 was already talked about, several years ago. Now, its been published in November, though I have to take a look at it. I've been using wxWidgets for years, but moved on to Qt for my own projects. So, lets have a look at wxWidgets 3.0...

Quick Q: Why have move semantics? -- StackOverflow

Quick A: Because value semantics are clean and naturally (exception-)safe, and avoid the brittleness of pre-C++11 workarounds that resort to owning raw pointers.

As often happens, the question contains the answer...

Why have move semantics?

... Can't the client already take advantage of pointers to do everything move semantics gives us? If so, then what is the purpose of move semantics?

Move semantics:

std::string f()
{
    std::string s("some long string");
    return s;
}
int main()
{
    // super-fast pointer swap!
    std::string a = f();
    return 0;
}

Pointers:

std::string *f()
{
    std::string *s = new std::string("some long string");
    return s;
}

int main()
{
    // still super-fast pointer swap!
    std::string *a = f();
    delete a;
    return 0;
}

Dive into C++11 (#2) -- Frametime/FPS, constexpr, uniform initialization, and more

Hello again, I’m Vittorio Romeo, a computer science student, hobbyist game developer and C++ enthusiast.

I've uploaded the second episode of "Dive into C++11" on my YouTube channel. You can find the first episode here.

You can find the complete playlist here.

In this episode we will learn more about two previously mentioned new awesome C++11 features: "constexpr" and "uniform initialization syntax".

Most importantly, we will also deal with a very big issue that every game developer must face: FPS/frametime, and how to avoid the game from behaving differently on slower/faster machines.

In addition, we'll also briefly learn about "const-correctness" and using the "noexcept" keyword.

We will analyze the "time-slice" method to allow the game to run smoothly and consistently on every machine.

In the last code segment, we will also "refactor" our code by creating a `Game` class, making our source much easier to read and maintain.

I greatly appreciate comments and criticism, and ideas for future videos/tutorials.

Feel free to fork the game's source code at: https://github.com/SuperV1234/Tutorials

Acquire and Release Fences Don't Work the Way You'd Expect -- Jeff Preshing

The C++11 standard makes a distinction between acquire and release fences and acquire and release operations. The differences are important and can affect correctness as well as performance.

[Ed.: These correctness subtleties are another reason to avoid standalone fences... in addition to the notes in this article, there are performance reasons to do so, as mentioned in Sutter's linked talk. std::atomics are the correct tool in nearly all cases where in the past you'd have reached for a standalone fence.]

Acquire and Release Fences Don't Work the Way You'd Expect

by Jeff Preshing

From the article:

... It's perhaps surprising, then, that this definition does not apply to standalone acquire and release fences in C++11! Those are a whole other ball of wax.

To see what I mean, consider the following two code listings. They’re both taken from my post about the double-checked locking pattern in C++11. The code on the left performs a release operation directly on m_instance, while the code on the right uses a release fence instead. ...

CppQuiz.org officially launched -- Anders Schau Knatten

Anders Schau Knatten recently launched the new site CppQuiz.org inspired largely by Olve Maudal's C++ pub quizzes. So grab a refreshing beverage, pull up a chair, and try a few to start off the first week of December...

CppQuiz.org officially launched!

by Anders Schau Knatten

From the announcement:

What is it

CppQuiz.org is (as you might have guessed by now) an online C++ quiz. Each question is a full C++ program, and you are to figure out what its output is. I stole this format from Olve Maudal's pub quizzes, but with one major difference: While his quizzes are about what happens on his computer (which is very interesting for a more interactive format), CppQuiz.org asks about what the standard mandates the output to be. If the example code doesn’t compile, or has unspecified/undefined behaviour, you answer that.

The site will just keep throwing questions at you (training mode), optionally giving you a hint and finally give you a full explanation of the answer, with references to the C++11 standard. If you want, you can however start a new quiz (quiz mode), and get a fixed number of questions. At the end you get a score, and a link to give your friends to see if they can beat you. Neither mode requires you to register or log in.

How you can help

If you like the quiz and want to help, there are many ways to do so:

  • Create your own questions, as many have done
  • Help improve the design (pull requests, e-mail, Twitter)
  • Help improve the functionality (pull requests, e-mail, Twitter)
  • Any other feedback (comments to this post, e-mail, Twitter)