July 2016

C++ User Group Meetings in August

The monthly overview on upcoming C++ User Group meetings on Meeting C++:

C++ User Group Meetings in August

by Jens Weller

From the article:

The monthly overview on the upcoming C++ User Group meetings. As there is again a group meeting at the first, I have to publish this today, so that there will still be some groups not in the listing, as they are publishing their meetings in the coming days. Still, already 26 groups will meet in August!

There are 3 new C++ User Groups: Copenhagen, Singapore, and Gdansk.

N4608: PL22.16/WG21 draft agenda: 7-12 Nov 2016, Issaquah, WA, US -- Clark Nelson

A new WG21 paper is available. If you are not a committee member, please use the comments section below or the std-proposals forum for public discussion.

Document number: N4608

Date: 2016-07-21

PL22.16/WG21 draft agenda: 7-12 Nov 2016, Issaquah, WA, US

by Clark Nelson

Excerpt:

The primary goals of this meeting will be:

  • Process ballot comments for C++17 CD (N4604)
  • Try to advance Library Fundamentals v2 to TS

Additional, lower-priority goals include:

  • Try to advance Modules to PDTS
  • Try to advance Ranges to PDTS
  • Try to advance Networking to PDTS
  • Try to advance Parallelism v2 to PDTS
  • Try to advance Concurrency v2 to NP

Memory consistency made simple(ish)--Glennan Carnie

How to synchronize between threqds or

Memory consistency made simple(ish)

by Glennan Carnie

From the article:

The C++11 memory consistency model is probably one of the most significant aspects of Modern C++; and yet probably one of the least well-understood.  I think the reason is simple:  it’s really difficult to understand what the problem actually is.

The memory consistency problem is a concurrency problem.  That is, it’s a problem that occurs when we start writing multi-threaded code.  More specifically, it’s a parallelism problem – the real subtleties occur when you have two or more processors executing code...

 

CppCon 2015 Test Driven C++ with Catch--Phil Nash

Have you registered for CppCon 2016 in September? Don’t delay – Registration is open now.

While we wait for this year’s event, we’re featuring videos of some of the 100+ talks from CppCon 2015 for you to enjoy. Here is today’s feature:

Test Driven C++ with Catch

by Phil Nash

(watch on YouTube) (watch on Channel 9)

Summary of the talk:

C++ has been notorious for being a second class citizen when it comes to test frameworks. There are plenty of them but they tend to be fiddly to set-up and ceremonious to use. Many of them attempt to follow the xUnit template without respect for the language environment they are written for. Catch is an attempt to cut through all of that. It is simple to get and simple to use - being distributed in a single header file - yet is powerful and flexible. Catch includes a number of innovations that make testing in C++ more natural - and fun - than ever before. This presentation introduces you to the unique approach that Catch brings to unit and integration testing - and how to use Catch to drive your design with TDD or BDD.

CppCast Episode 65: PLF Library with Matt Bentley

Episode 65 of CppCast the only podcast for C++ developers by C++ developers. In this episode Rob and Jason are joined by Matt Bentley to discuss plf::colony<> and plf::stack<> and some of their advantages over std::vector<> and std::stack<>.

CppCast Episode 65: PLF Library with Matt Bentley

by Rob Irving and Jason Turner

About the interviewee:

Matt Bentley was born in 1978 and never recovered from the experience. He started programming in 1986, completing a BSc Computer Science 1999, before spending three years working for a legal publishing firm, getting chronic fatigue syndrone, quitting, building a music studio, recovering, getting interested in programming again, building a game engine, and stumbling across some generalized solutions to some old problems.

PVS-Studio confesses its love for Linux

You will help greatly if you volunteer to help testing the beta-version of PVS-Studio for Linux.

PVS-Studio confesses its love for Linux

by Andrey karpov

From the article:

PVS-Studio is a tool for bug detection in the source code of programs, written in C, C++, and C#. We are looking forward to the moment that we'll have something to present to this world. I hope this article brought some intrigue, and that Linux developers will want to try scanning their projects with PVS-Studio. If you have time and wish to, I invite you to become a part of the beta-tester team.

Const Correctness--Arne Mertz

Do you use const well?

Const Correctness

by Arne Mertz

From the article:

Writing const correct code is about more than using const in a few places and letting the compiler figure out if it makes sense.

There are two components about using the keyword const in C++ code: A syntactic component and a semantic component...

Quick Q: Conditional use of std::lock_guard

Quick A: Use std::unique_lock instead.

Recently on SO:

Conditional use of std::lock_guard

How about this one?

void bar(std::mutex * optionalMutex = nullptr)
{
        auto lockScope = (optionalMutex == nullptr) ?
                           std::unique_lock<std::mutex>()
                         : std::unique_lock<std::mutex>(*optionalMutex);

}

Explanation: You're compiler had trouble with your prior statement because, you can not suddenly change the type of the ternary ? expression, i.e. the literal 0 is not a std::lock_guard and vice versa. So I changed the two branches to the same type, here std::unique_lock<std::mutex> because lock_guard isn't designed be used without a valid mutex. But still prefer std::lock_guard over std::unique_lock in the simpler cases, because it will make you code more readable.

Also your statement wasn't viable for the compiler, i.e. even syntactical correct, because the variable lockScope would only have existed in one branch.

Move safety - know what can be done in the moved-from state--Jonathan Müller

What state is an object after move?

Move safety - know what can be done in the moved-from state

by Jonathan Müller

From the article:

C++ programmers have this notion of exception safety. It is a very useful concept. With it one can easily describe the post-conditions of a function if it throws.

There is another situation where you need to easily describe some post-conditions: when talking about the state of an object after a move operation, i.e. after a move constructor or move assignment operator. I thus want to introduce vocabulary for those post-conditions of the right-hand argument similar to the exception safety of a function: The move safety, if you will.

The exception safety describes the post-conditions of a function if the function throws an exception. Similarly, the move safety describes the post-conditions of the object after a move operation. It thus gives information about what can be done safely with a moved-from object...

C++/Graphics Workshop--Stephanie Hurlburt

Are you interested?

C++/Graphics Workshop

by Stephanie Hurlburt

Description of the event:

Ever been curious about C++ and graphics programming, but not sure where to start?
Maybe you are an artist who'd like to build your own tools. Maybe you're a game developer wishing your games would run faster, or have even better graphics effects. Regardless, knowledge of the way graphics work at a low level is an empowering skill.
We'll be covering real-time graphics with C++/OpenGL as well as raytracing. It'll be aimed at beginners, but everyone is welcome.
This'll be an intimate workshop, meant for around 20 people. We'll give a talk and then walk you through some hands-on examples. Be sure to bring a laptop if you can!