July 2015

CppCon 2014 C++ Test-driven Development--Peter Sommerlad

Have you registered for CppCon 2015 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 2014 for you to enjoy. Here is today’s feature:

C++ Test-driven Development

by Peter Sommerlad

(watch on YouTube) (watch on Channel 9)

Summary of the talk:

Unit Testing and TDD, if applied correctly, lead to high quality and simple code. If done by hand, both often require writing some boiler-plate code and can be slow and cumbersome. Especially refactoring without good tool support can be a burden. Java and C# developers are used to have good tool support for these tasks to be effective. Many C++ developers often aren't even aware of the need for the practices, because without tool support and training of the goals, they are hard to discover.

This talk introduces C++ Unit Testing, Test-driven Development, and Refactoring and demonstrates the tooling available for Eclipse CDT for free on www.cevelop.com that was inspired and implemented by the author and his team.

For example, when phrasing a unit test to use a to-be-defined class, the class is generated automatically from its name used as a type. Another tool feature is simplifying a function, by extracting a sub-function and placing a call in its place.

Efficient optional values -- Andrzej Krzemieński

Andrzej goes into some details of optional values in his recent blog post.

Efficient optional values

by Andrzej Krzemieński

From the article:

What do you use Boost.Optional for? In my experience, the answer was typically one of the following:

  1. Because my type T has no null state (like -1) that would indicate that I have no proper value.
  2. Because, I need to perform a two-phase initialization (I cannot initialize my T yet, but I already need it alive).
  3. Because I need an interface that would indicate to the type system that my value may not be there and that its potential absence should be checked by the users.

In this post we will focus exclusively on the third motivation.

Bitesize Modern C++: using aliases--Glennan Carnie

Do you know how to use type aliasing?

Bitesize Modern C++: using aliases

by Glennan Carnie

From the article:

In a C++ program it is common to create type aliases using typedef. A type alias is not a new type, simply a new name for an existing declaration. Used carefully, typedef can improve the readability and maintainability of code – particularly when dealing with complex declarations...

Programmatic access to the call stack in C++--Eli Bendersky

The call stack can be accessed without debugger too:

Programmatic access to the call stack in C++

by Eli Bendersky

From the article:

Sometimes when working on a large project, I find it useful to figure out all the places from which some function or method is called. Moreover, more often than not I don't just want the immediate caller, but the whole call stack. This is most useful in two scenarios - when debugging and when trying to figure out how some code works...

CppCon 2014 Making Allocators Work, Part II—Alisdair Meredith

Have you registered for CppCon 2015 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 2014 for you to enjoy. Here is today’s feature:

Making Allocators Work, Part II

by Alisdair Meredith

(watch on YouTube) (watch on Channel 9)

Summary of the talk:

Memory is an important property for every object, as whatever resources it manages, it must occupy some memory. THe ability to customize memory allocation is important for every C++ program that cares about performance, debug ability and support.

The original C++ standard supported an allocator parameter for every container, yet this feature was widely derided or ignored, as it was underspecified to the point it could not portably be used. C++11 makes significant changes to the allocator model, that simply its use while making it more powerful.

The Library Fundamentals TS goes further, allowing allocators’ type to be supplied at runtime, rather than compile type, using classic object oriented polymorphism - yet building on the infrastructure laid down in C++11.

This material should be of interest to both library authors and consumers, although clearly there are more details for the implementers to absorb. It also includes an interesting case study in C++11 compile time reflection, as required to implement the new ‘allocator_traits’ facility.

PeriodicFunction--Tony “Bulldozer00” (BD00) DaSilva

An interesting article showing how to call a function periodically:

PeriodicFunction

by Tony “Bulldozer00” (BD00) DaSilva

From the article:

In the embedded systems application domain, there is often the need to execute one or more background functions at a periodic rate. Before C++11 rolled onto the scene, a programmer had to use a third party library like ACE/Boost/Poco/Qt to incorporate that functionality into the product. However, with the inclusion of std::thread, std::bind, and std::chrono in C++11, there is no longer the need to include those well-crafted libraries into the code base to achieve that specific functionality...

CppCon 2014 Making Allocators Work, Part I--Alisdair Meredith

Have you registered for CppCon 2015 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 2014 for you to enjoy. Here is today’s feature:

Making Allocators Work, Part I

by Alisdair Meredith

(watch on YouTube) (watch on Channel 9)

Summary of the talk:

Memory is an important property for every object, as whatever resources it manages, it must occupy some memory. THe ability to customize memory allocation is important for every C++ program that cares about performance, debug ability and support.

The original C++ standard supported an allocator parameter for every container, yet this feature was widely derided or ignored, as it was underspecified to the point it could not portably be used. C++11 makes significant changes to the allocator model, that simply its use while making it more powerful.

The Library Fundamentals TS goes further, allowing allocators' type to be supplied at runtime, rather than compile type, using classic object oriented polymorphism - yet building on the infrastructure laid down in C++11.

This material should be of interest to both library authors and consumers, although clearly there are more details for the implementers to absorb. It also includes an interesting case study in C++11 compile time reflection, as required to implement the new 'allocator_traits' facility.

Three years of Meeting C++

A little more then 3 years ago, Meeting C++ launched:

Three years of Meeting C++

by Jens Weller

From the article:

Its now a little more then 3 years that I went public with the plans for a new C++ Conference. Today, Meeting C++ is much more, it has become a platform for C++ User Groups, but also a great source of C++ related news. I had no idea, how much my life would change, when I started to make serious plans for the very first Meeting C++ conference...

CppCon 2014 ODB, Advanced Weapons and Tactics--Boris Kolpackov

Have you registered for CppCon 2015 in September? Don’t delay – Early Bird registration is open now.

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

ODB, Advanced Weapons and Tactics

by Boris Kolpackov

(watch on YouTube) (watch on Channel 9)

Summary of the talk:

Hiding a relational database behind an ORM does not work. Did I just say that? Yes! Performance and scalability limitations always get in the way. Should we then throw away the whole ORM idea and go back to SQL? We don't have to. In fact, the bulk of ODB features were specifically designed to resolve these limitations without degenerating to JOINs and SQL. And that's what the second part of this talk is all about: bulk operations, object caches, lazy pointers, views, change-tracking containers, optimistic concurrency, object sections (partitions), and prepared and cached queries. By the end of the second half you will be ready for anything that real-world C++ object persistence and database access can throw at you.

CppCast Episode 19: WebAssembly with JF Bastien

Episode 19 of CppCast the only podcast by C++ developers for C++ developers. In this episode Rob and Jason are joined by JF Bastien to discuss WebAssembly.

CppCast Episode 19: WebAssembly with JF Bastien

by Rob Irving and Jason Turner

About the interviewee:

JF Bastien is a compiler engineer and tech lead on Google’s Chrome web browser, currently focusing on performance and security to bring portable, fast and secure code to the Web. JF is a member of the C++ standards committee, where his mechanical engineering degree serves little purpose. He’s worked on startup incubators, business jets, flight simulators, CPUs, dynamic binary translation, systems, and compilers.