CppCon 2015 Faster Complex Numbers--André Bergner

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

Faster Complex Numbers

by André Bergner

(watch on YouTube) (watch on Channel 9)

Summary of the talk:

Complex numbers are an important tool from mathematics enabling many problems to be written in a more generic form. The C++ standard library comes with an implementation to work with complex numbers in a natural way.

Motivated by useful real world examples from theoretical physics and audio dsp I will discuss benchmarks of std::complex and demonstrate how alternative implementations, naïve or advanced ones based on expression templates, outperform std::complex and can compete with hand-crafted C code (depending on compiler and std lib). A quick introduction to expression templates will be provided.

Italian C++ Conference 2016--Marco Arena

A brief article on the first edition of:

Italian C++ Conference 2016

by Marco Arena

From the article:

After two years of meetups and participations in Italy, last Saturday we had more than 100 people attending (130+ registered people – ~22% drop) the first edition of the Italian C++ Conference, in Milan, our new free event fully focused on C++. Hosted by “Bicocca” University and sponsored by RogueWave Software, we delivered 5×60′ technical sessions, 1×30′ sponsor demo session and 1×40′ Q/A panel. It has been a great day!...

C++Now 2016 trip report--Vittorio Romeo

Do you want to know what happened at the last C++Now?

C++Now 2016 trip report

by Vittorio Romeo

From the article:

I am very happy to have been part of the C++Now conference for another year, and I hope that I'll be able to come back in the future.

This year, I participated both as a speaker and as a Student/Volunteer.

The experience was, again, simply fantastic: I spent four days in a beautiful location, attended some of the most technically advanced and innovative C++ talks and, most importantly, had the occasion to meet a lot of amazing people.

As a Student/Volunteer, my tasks included: recording the talks, helping during the lunch break/picnic, assisting speakers during sessions and generally helping attendees when possible.

I'd like to thank Jon Kalb, Bryce Lelbach, and the rest of conference staff for making my participation possible.

In this trip report, I'll briefly describe some of my favorite talks and what I have learned from them, then introduce my sessions...

Jacksonville C++ Core Language Meeting Report--Jason Merrill

Here are the latest news about the future of C++:

Jacksonville C++ Core Language Meeting Report

by Jason Merrill

From the article:

There were three of us from Red Hat at the C++ meeting in Jacksonville, FL back in February, and it seems I never posted my trip report. So here it is now.

This was a fairly eventful meeting, as we’re rapidly approaching C++17 and so the big question on everyone’s minds was “What’s going to make it in?” In the end, many things did, but not Concepts, which some had been hoping for as a headline item.

We started and finished the week looking at the list of Technical Specifications that we were considering incorporating into C++17...

 

CppCon 2015 Memory and C++ debugging at Electronic Arts--Scott Wardle

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

Memory and C++ debugging at Electronic Arts

by Scott Wardle

(watch on YouTube) (watch on Channel 9)

Summary of the talk:

Scott Wardle a senior software engineer Electronic Arts will talk about the current memory and C++ debugging setup and tools used in games.

PS4 and Xbox One have virtual memory and 64 bit address spaces, GPU and CPU are getting closer in the ability to work virtual memory. So our tools are getting better and better and closer to PCs. Most of a games memory goes towards art and level data like bitmap textures and polygon meshes. So artist and designer need to understand how much their data takes up. Giving them call stacks of memory allocations does not help. They want to know how big is a group of building is. Why is this group of building bigger than this one? Maybe this one has some animation data or one of the textures is too big. But there are 10,000s of objects built by 100s of people all around the world.

Folds(ish) in C++11

Folds of variadic expressions are coming in C++17, but what about today?

Folds(ish) in C++11

by Jason Turner

From the article:

It is possible to perform some form of the variadic folds that are coming in C++17 with the C++11 and C++14 compilers that we have available today by using just a little bit of creativity.

...

Someone (not me) figured out that we can abuse the std::initializer_list type to let us guarantee the order of execution of some statements while not having to recursively instantiate templates. For this to work we need to create some temporary object to let us use the braced initializer syntax and hold some result values for us.

Only problem is, our print function doesn’t return a result value. So what do we do? Give it a dummy return value!

#include <iostream>

template<typename T>
void print(const T &t)
{
  std::cout << t << '\n';
}

template<typename ... T>
  void print(const T& ... t)
{
  std::initializer_list<int>{ (print(t), 0)... };
}

int main()
{
  print(1, 2, 3.4, "Hello World");
}

...

(And we continue to simplify it much more from here...)

Quick Q: std::rethrow_exception and thrown exception type

Quick A: std::make_exception_ptr creates a reference on a copy.

Recently on SO:

std::rethrow_exception and thrown exception type

From documentation for std::make_exception_ptr:

Creates an std::exception_ptr that holds a reference to a copy of e.

Unfortunately, copying e means you get object slicing (which @Mohamad Elghawi points out is also more prominently mentioned later on that page). When you call std::make_exception_ptr<RecognitionException>, it will hold a copy of a RecognitionException, not any derived class.

But you don't need exception_ptr at all here. Even though reportError does not have the try...catch in scope, you can still use throw; to re-throw the current exception.

#include <stdio.h>

struct A { virtual ~A() = default; };
struct B : A { };

void reportError() {
  try {
    throw;
  }
  catch (B &) {
    puts("caught B");
  }
  catch (A &) {
    puts("caught A");
  }
}

int main() {
  try {
    throw B();
  }
  catch (A &) {
    reportError();
  }
}