News

Quick Q: std::timed_mutex::try_lock* fail spuriously

Quick A: it is authorized to do so for performance reasons.

Recently on SO:

Quick Q: std::timed_mutex::try_lock* fail spuriously

According to: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3209.htm

On the other hand, there are strong reasons to require that programs be written to tolerate spurious try_lock() failures:

  1. As pointed out in Boehm, Adve, "Foundations of the C++ Concurrency Memory Model", PLDI 08, enforcing sequential consistency for data-race-free programs without spurious try_lock() failures requires significantly stronger memory ordering for lock() operations on try_lock()-compatible mutex types. On some architectures that significantly increases the cost of uncontended mutex acquisitions. This cost appears to greatly outweigh any benefit from prohibiting spurious try_lock() failures.
  2. It allows a user-written try_lock() to fail if, for example, the implementation fails to acquire a low-level lock used to protect the mutex data structure. Or it allows such an operation to be written directly in terms of compare_exchange_weak.
  3. It ensures that client code remains correct when, for example, a debugging thread is introduced that occasionally acquires locks in order to be able to read consistent values from a data structure being checked or examined. Any code that obtains information from try_lock() failure would break with the introduction of another thread that purely locks and reads the data structure.

CppCast Episode 35: CppCon Wrapup with Jon Kalb

Episode 35 of CppCast the only podcast for C++ developers by C++ developers. In this episode Rob and Jason are joined by Jon Kalb to talk about this year's Cppcon, his trip to the Kona standards committee meeting and much more.

CppCast Episode 35: CppCon Wrapup with Jon Kalb

by Rob Irving and Jason Turner

About the interviewee:

Jon has been writing C++ for two and half decades and does onsite C++ training. He chairs the CppCon and C++Now conferences and the C++ Track for the Silicon Valley Code Camp. He serves as chair of the Boost Libraries Steering Committee and is a Microsoft MVP.

Overload resolution -- Andrzej KrzemieĊ„ski

An introduction to function template specialization, function (template) overloading, argument dependent lookup (ADL) and overload resolution:

Overload resolution

by Andrzej Krzemieński

From the article:

This post is an introduction to another one that I intend to write in the future...

Announcing the VS GDB Debugger extension--Marc Goodner

Annoucing a new tool in Visual Studio:

Announcing the VS GDB Debugger extension

by Marc Goodner

From the article:

Earlier this year I wrote a post on how you could debug C++ code on Linux from Visual Studio. It was a bit cumbersome, but it was doable. Today we are releasing the Visual Studio GDB Debugger extension preview. This will enable debugging remote Linux targets including IoT devices...

C++ meetup in Madrid, Spain: C++ in the video game industry.

Yes! A new edition of the local C++ meetup will take place on the 4th of December at Google Campus' facilities. All the info and RSVPs below:

C++ en la industria del videojuego

by Jordi Mon Companys.

What to expect?

Jose Daniel García will moderate a table of experts in gamedev in C++ that will friendly elbaorate on the state of the language on regards to gamedev, its advantages and threats. Afterwards we will join forces with Product Hunt Madrid and we will have the chance to hear how King develops its games and how a group of students from U-Tad university have managed to get their game nominated to the Play Station Awards. We will water down our thoughts and reflections with plenty of beer thanks to King.com's sponsorship.

Breaking all the Eggs in C++ -- Scott Meyers

Scott Meyers takes a deeper look into uninitialized memory in his recent blog post.

Breaking all the Eggs in C++

by Scott Meyers

From the article:

If you want to make an omelet, so the saying goes, you have to break a few eggs. Think of the omelet you could make if you broke not just a few eggs, but all of them! Then think of what it'd be like to not just break them, but to replace them with newer, better eggs. That's what this post is about: breaking all the eggs in C++, yet ending up with better eggs than you started with.

NULL, 0, and nullptr

NULL came from C. It interfered with type-safety (it depends on an implicit conversion from void* to typed pointers), so C++ introduced 0 as a better way to express null pointers. That led to problems of its own, because 0 isn't a pointer, it's an int. C++11 introduced nullptr, which embodies the idea of a null pointer better than NULL or 0. Yet NULL and 0-as-a-null-pointer remain valid. Why? If nullptr is better than both of them, why keep the inferior ways around?

Backward-compatibility, that's why. Eliminating NULL and 0-as-a-null-pointer would break exiting programs. In fact, it would probably break every egg in C++'s basket. Nevertheless, I'm suggesting we get rid of NULL and 0-as-a-null-pointer, thus eliminating the confusion and redundancy inherent in having three ways to say the same thing (two of which we discourage people from using).

CppCast Episode 34: High Performance Computing with Dmitri Nesteruk

Episode 34 of CppCast the only podcast for C++ developers by C++ developers. In this episode Rob and Jason are joined by Dmitri Nesteruk to talk about High Performance Computing and some of the new features coming to Clion and ReSharper for C++ from JetBrains.

CppCast Episode 34: High Performance Computing with Dmitri Nesteruk

by Rob Irving and Jason Turner

About the interviewee:

Dmitri Nesteruk is a developer, speaker, podcaster and a technical evangelist at JetBrains. His interests lie in software development and integration practices in the areas of computation, quantitative finance and algorithmic trading. His technological interests include C#, F# and C++ programming as well high-performance computing using technologies such as CUDA. He has been a C# MVP since 2009.

HPX version 0.9.11 released -- STE||AR Group

The STE||AR Group has released V0.9.11 of HPX -- A general purpose parallel C++ runtime system for applications of any scale.

HPX V0.9.11 Released

The newest version of HPX (V0.9.11) is now available for download! Please see here for the release notes.

HPX exposes an API fully conforming to the concurrency related parts of the C++11 and C++14 standards, extended and applied to distributed computing.

From the announcement:

  • In this release our team has focused on developing higher level C++ programming interfaces which simplify the use of HPX in applications and ensure their portability in terms of code and performance. We paid particular attention to align all of these changes with the existing C++ Standard or with the ongoing standardization work. Other major features include the introduction of executors and various policies which enable customizing the ‘where’ and ‘when’ of task and data placement.
  • This release consolidates many of the APIs exposed by HPX. We introduced a new uniform way of creating (local and remote) objects, we added distribution policies allowing to manage and customize data placement and migration, we unified the way various types of parallelism are made available to the user.

Introduction to Variable Templates of C++14--Yu Xuan Zhang

Do you know about variable templates?

Introduction to Variable Templates of C++14

by Yu Xuan Zhang

From the article:

The variable template, which comes from N3651, is one of the major proposals in Standard C++14. The main purpose of the variable template is to simplify definitions and uses of parameterized constants.

Rules before C++14 do not allow declaring a variable using a template declaration. There are workarounds for this problem before C++14, but they are either redundant or complicated...