News

CppCon 2014 Exception-Safe Code, Part I--Jon Kalb

While we wait for CppCon 2015 in September, we’re featuring videos of some of the 100+ talks from CppCon 2014. Here is today’s feature:

Exception-Safe Code, Part I

by Jon Kalb

(watch on YouTube) (watch on Channel 9)

Summary of the talk:

Are you 100% confident that your code is exception-safe?

Safe usage of exceptions is a non-trivial problem that the industry has struggled with for the better part of two decades. If you have fear, uncertainty, or doubt about exception safety or just want to see the best practices for using exceptions in C++ and/or C++11/14, this session is for you. We'll start with "What is the problem we are trying to solve?" and discuss alternatives, acknowledge the challenges associated with exception usage, and cover some well-meaning but misguided attempts at safety. I will then present a set of guidelines that are the basis for safe exception usage and solid implementation techniques, including how to transition from an exception-unsafe legacy code base.

When we are finished you will know how to produce code that is easier to write, easier to understand, faster, and 100% robust in the face of exceptions.

Boost Version 1.58 Released

The next version of boost is released.

Boost 1.58

From the release note:

These new libraries were added:

  • Endian: Types and conversion functions for correct byte ordering and more regardless of processor endianness.
  • Sort: Includes spreadsort, a general-case hybrid radix sort that is faster than O(n*log(n))

A huge number of bugfixes and improvements were implemented for the existing libraries.

 

Many thanks to all contributors and maintainer!

CppCast Episode 8: Biicode and Turbo with Manuel Sanchez

Episode 8 of CppCast the only podcast by C++ developers for C++ developers. In this episode Manuel Sanchez joins Rob Irving to talk about Biicode, the C++ dependency manager and Manuel's Template Metaprogramming Library Turbo.

CppCast Episode 8: Biicode and Turbo with Manuel Sanchez

by Rob Irving

About the interviewee:

As a CS undergraduate at the University of Madrid (Spain) and self taught C++ programmer, Manuel Sanchez has been working on personal projects related to Modern C++ during his free time, most of them related to template metaprogramming and his own efforts to give high level features for C++ metaprogramming: The Turbo Metaprogramming Library. Manuel has been working for biicode since September 2014, he assist his fellow biis by dealing with C++ idiosyncrasies while manage very successful posts about template metaprogramming and his work on Turbo.

biicode Dependency Manager released to Open Source

biicode just released the client code of their C++ Dependency Manager into OpenSource.

C/C++ Dependency Manager

From the Website:

biicode manages your project’s dependencies so you can use the libs you need (Curl, Catch, Fann, OpenSSL, OpenCV, POCO, Boost, Libuv, GTest ...) as you wish within your project. biicode uses CMake to configure and build your projects and it is compatible with many IDEs, version control systems and compilers.

CppCon 2014 0xBADC0DE--Jens Weller

While we wait for CppCon 2015 in September, we’re featuring videos of some of the 100+ talks from CppCon 2014. Here is today’s feature:

0xBADC0DE

by Jens Weller

(watch on YouTube) (watch on Channel 9)

Summary of the talk:

My motivation for this talk is my own expierence as a freelancer and trainer. I have seen a lot of good and bad code in different places. As a freelancer I often had to deal with different, unknown and often large codebases. This talk tries not only to show examples of bad code, but also to analyze why it exists in the first place, and how to deal with it or fix it. I'll visit anti-patterns, but this talk is not about anti-patterns, as that would only spotlight one of the many problems.

CLion 1.0, cross-platform C/C++ IDE, has finally arrived

CLion 1.0 is out.

JetBrains has finally released CLion - cross-platform IDE for C and C++ developers

By Anastasia Kazakova

From the article:

CLion is a full-featured IDE for developing in C and C++ on Linux, OS X or Windows. It's deeply integrated with the well-known CMake build system and GDB debugger, as well as with many popular Version Control Systems. CLion provides productivity boosting features, including smart editor, one-click navigation, reliable refactorings and on-the-fly code analysis with quick-fixes, to keep your C/C++ code high-quality.

C++11 is the second "most loved" language/technology on StackOverflow according to the survey

In case you missed it, an interesting data point about how much programmers appreciate the improvements in C++11 (and 14) compared to C++98. As Stroustrup frequently says, C++11 feel like a new language. Note “love” means in the sense of “enjoy programming in”… more people are willing to say they enjoy programming in modern C++, and C++11 truly was a turning point and progress is continuing:

C++11 is the second "most loved" language/technology on StackOverflow according to the survey

Quick Q: Can I do something like range-for with a counting loop?

Quick A: Yes. Start with boost::irange.

Recently on SO:

Can I do something like range-for with a counting loop?

Actually this are two related questions.

I know there is new syntax in C++11 for range based for loops of the form:

//v is some container
for(auto &i: v){
   // do something with i
}

First question: how can I infer at which iteration I am in this loop? (Say I want to fill a vector with value j at position j).

Second question: I wanted to now if there also is some other way to write a loop of the form

for(int i=0; i<100; i++){ ... }

I find this way of writing it a bit cumbersome and I do this so often and I would love to have a more concise syntax for it. Something along the lines:

for(i in [0..99]){ ... }

would be great.

For both questions I would like to avoid having to use additional libraries.

Quick Q: How is “=default” different from “{}” for default constructor and destructor?

Quick A: The "= default" keeps the type trivial.

Recently on SO:

How is “=default” different from “{}” for default constructor and destructor?

I originally posted this as a question only about destructors, but now I'm adding consideration of the default constructor. Here's the original question:

If I want to give my class a destructor that is virtual, but is otherwise the same as what the compiler would generate, I can use =default:

class Widget {
public:
   virtual ~Widget() = default;
};

But it seems that I can get the same effect with less typing using an empty definition:

class Widget {
public:
   virtual ~Widget() {}
};

Is there any way in which these two definitions behave differently?

Based on the replies posted for this question, the situation for the default constructor seems similar. Given that there is almost no difference in meaning between "=default" and "{}" for destructors, is there similarly almost no difference in meaning between these options for default constructors? That is, assuming I want to create a type where the objects of that type will be both created and destroyed, why would I want to say

Widget() = default;

instead of

Widget() {}

?

I apologize if extending this question after its original posting is violating some SO rules. Posting an almost-identical question for default constructors struck me as the less desirable option.