The Rule of Zero -- Glennan Carnie

A complementary guideline to help to simplify the application code, without risking resource management issues.

The Rule of Zero

In a previous article – "The Rule of the Big Four (and a half)" we looked at resource management policies in C++.

Resource management is the general term for using the mechanisms in C++ to ensure that resources – files, dynamic memory, sockets, mutexes, etc – have their lifetimes automatically controlled so as to prevent resource leaks, deadlocks, etc. C++ refers to these mechanisms as RAII/RDID ( “Resource Acquisition Is Initialisation / Resource Destruction is Deletion”)

In this article we’ll have a look at a complementary guideline to help simplify your application code, without risking resource management issues – The Rule of Zero.

If you’re not familiar with the concepts of resource management I’d highly recommend having a look at the whitepaper before reading on.

Deleaker For Free For OpenSource Project Owners

[From time to time vendors use Suggest an Article to submit blog suggestions, like this one. We felt this would be of interest to readers. --Ed.]

 

Free License Offer

We've decided to offer Deleaker for free for all who has open source projects and want to fix leaks in the code fast. We just ask to mention Deleaker. That's all.

To get a license please contact us.

What is Deleaker?

Deleaker is a tool for Visual C++ developers to find memory leaks, GDI leaks, COM / OLE leaks, handle leaks and other leak types.

In the past Deleaker was available as extension for Visual Studio 2005, 2008, 2010, 2012 and 2013. Unfortunately it made Deleaker unavailable for those who uses Express Edition as Express Edition doesn't support extensions.

We have just released new build 3.0.27 that includes standalone edition of Deleaker.

How does Deleaker work?

Deleaker is based on hooks. For each allocation and deallocation it saves stack traces and one a user click to Take snapshot it shows all allocations that are not freed yet.

Deleaker is available as Visual Studio extension and as a standalone tool.

Just a few screenshots. Extension mode:

Standalone edition of Deleaker:

C++ in 2015

My yearly overview on the things that might come:

C++ in 2015

by Jens Weller

From the article:

The year is still young, so lets have an outlook about what is going to happen in C++ Land in 2015...

The C++ Memory Model - Valentin Ziegler @ Meeting C++ 2014

A new video from Meeting C++ 2014:

The C++ Memory Model

by Valentin Ziegler

From the talk description:

The C++ memory model defines how multiple threads interact with memory and shared data, enabling developers to reason about concurrent code in a platform independent way. The talk will explain multi-threaded executions and data races in C++...

Reader Q&A: auto and for loop index variables -- Herb Sutter

Discussion on how to use/replace auto for loop index variables.

Reader Q&A: auto and for loop index variables

by Herb Sutter

From the reader's question:

So I’ve been reading all I can about c++11/c++14 and beyond when time permits.  I like auto, I really do, I believe in it.  I have a small problem I’m trying to decide what to do about.  So in old legacy code we have things like this:

for (int i = 0; i < someObject.size(); i++) { … }

New C/C++ compiler for Linux on z Systems -- IBM

ibm.PNGAnother modern C++ compiler released by IBM, based on a modern foundation:

New C/C++ compiler for Linux on z Systems

Today, IBM announced a brand new C/C++ compiler for Linux on z Systems. Built on top of the advanced optimization technology already in use by the Java and Enterprise COBOL compilers, the XL C/C++ for Linux on z Systems compiler generate highly optimized code to significantly improve runtime performance of applications. It leverages the Clang open source infrastructure for a portion of the compiler front end resulting in a high level of source compatibility with GCC and includes partial support of the latest C11 and C++11 language standards. In addition, the XL C/C++ for Linux on z Systems is able to exploit the new z13 hardware announced today through the use of the qarch and qtune suboptions. High performance mathematics libraries, MASS (Mathematical Acceleration Subsystem) and ATLAS (Automatically Tuned Linear Algebra Software) will also be packaged with the compiler and made available for the first time on zLinux.

The XL C/C++ for Linux on z Systems V1.1 runs on RHEL 6, RHEL 7, SLES 11, and SLES 12 and will become generally available on February 16, 2015. For more information on this new compiler, visit the XL C/C++ for Linux on z Systems product page.

Implementing std::tuple From The Ground Up – Part 1--Sasha Goldshtein

Sasha Goldshtein begins to show us how to implement the basis of a useful tool from the STL: the tuple.

Implementing std::tuple From The Ground Up – Part 1

by Sasha Goldshtein

From the article:

std::tuple is a very nice facility originally introduced in C++ TR1. It is a heterogenous container of elements that has a statically known size. In C++ 11, std::tuple can be implemented using variadic templates; a single std::tuple class can support an arbitrary number of template type arguments. In this series of blog posts we will implement std::tuple from first principles. The purpose of this exercise is not to provide the best-performing or most-conformant tuple implementation, but rather to see what foundational concepts are required to implement it...