SD West 2008

Earlier this week, I have attended Stroustrup and Sutter on C++ session at the SD West 2008 conference in Santa Clara, CA. As usual, session was packed with information mainly focused on the upcoming standard, the multi-core revolution we are are just starting to witness and a healthy dose of humor from both speakers and audience.

So, what’s making it in the standard? Many good things, some still in the working. If I’d have to single out my favorite, it was to learn that lambdas were voted in last week, so we’ll be able to do things like this:

void f(vector& v)
{
auto p = find_if(v.begin(), v.end(), [](int x){return x<7;});
}

This is important for two reasons:

  • it makes a very powerful (and underused) portion of STL – algorithms – much more convenient to use
  • it is very much in sync with recent surge of interest in functional languages, so (once again) C++ remains in the mainstream

There are many things coming in, too many to mention all here. For the curious reader, WG21 page is the best source of information. Anything expected that won’t make it into the standard? Yes – garbage collection. The committee could not reach consensus on it.

Herb Sutter gave few remarkable talks and demonstrations about the brave new multi-core world we are living in. More cores means faster, right? Well, maybe. Having multiple cores can actually slow you down in some scenarios. Yes, you add cores and run slower than you did with single core. And then, less CPU cycles means shorter time, right? Well, it depends. In a multi-core universe, as it turns out, sometimes less is more. Or more is less, whichever way you want it. So, in a well-intentioned and naive attempt to optimize, you get rid of some code and you end up running – slower. If you are surprised, welcome to the club. Herb demonstrated it convincingly on a live system. Again, since I can not do it justice in this frame, details are out of scope here, but let me just mention it has to do with multi-level caches. If you follow Herb’s articles, you’ll learn about it. He’s also putting out a book on the subject later this year. No doubt it’ll make for a good bedtime reading.

Worth mentioning here is the issue of thread interruption. Quite some time ago, we’ve had a heated discussion on the topic with a Java user demanding adamantly that we put it in. I have to admit that, at the time, I was not completely familiar with the exact mechanism how Java (or C#) actually do this. However, intuitively, I knew that there can not be any magic there. It is simply a bad idea and Herb has confirmed it in one of his talks. As it turns out, Java and C# had to learn it the hard way. As for the request originator, I must be fair here and say that he recently apologized for his manners and we have gladly accepted his apology.

It was interesting to learn how concepts allow to get rid of significant chunks of iterators documentation and those clumsy traits. I was also curious and took this opportunity to ask the creator of C++ what is his position on coding activity, i.e. whether programming computers is building/construction or rather a design activity. His answer was: “When you are programming, you are designing. But more than anything else, you are learning.” I have to agree.

I have noticed that the room was packed full this time, compared to maybe ~2/3 last year. Bjarne Stroustrup confirmed that his speaking invitations are significantly on the rise in the last few years. He is also working on popularizing C++ in education and will publish a C++ textbook for novice programmers later this year.

And then, on the lighter side, Herb brought in a synthesizer, put together some geek lyrics adjusted to well known tunes, such as Bohemian Rhapsody (“Mama, just killed a thread …”) and the Cheers theme tune (“Where everybody locks the same …”). He needed support performing, so he managed to talk few clowns into singing with him in front of about 300 people. Don’t tell anyone, but your humble correspondent was one of them. Now I live in a constant state of fear hoping the thing does not somehow find its way to YouTube 😉

The bottom line? Good conference, speakers as competent as humanly possible, a lot of useful information. In a nutshell: C++ is alive and well.

Stroustrup, Sutter and Fabijanic