News

18 C++ User Group Meetings in October

The monthly overview on upcoming C++ User Group Meetings:

C++ User Group Meetings in October

by Jens Weller

From the article:

The monthly overview on the meetings of C++ User Groups world wide:

1.10 C++ UG Austin - Understanding and Using Generic Libraries in C++
2.10 C++ UG Paris - C++ FRUG #4 - C++ & Python
2.10 C++ UG New York - An Evening with Bjarne Stroustrup
2.10 C++ UG Madrid - De 0 a 100 (Taller)
2.10 C++ UG Istanbul - R-value references and Move Semantics
8.10 C++ UG San Francisco/ Bay area - Presentation and Q&A
9.10 C++ UG Dresden - Build Systems
11.10 C++ UG Pune, India - A hands-on introduction to the Boost Libraries
15.10 C++ UG Montpellier - Rencontre C++
15.10 C++ UG Düsseldorf - Coding Dojo
15.10 C++ UG Santa Barbara - Kickoff meeting
16.10 C++ UG Seattle/North West - Compiler Technologies
20.10 C++ UG Denver - Coding Dojo
21.10 C++ UG Berlin - No topic yet.
22.10 C++ UG Hamburg - Einführung in MPI
22.10 C++ UG San Francisco/ Bay area - Workshop and Discussion Group
23.10 C++ UG Bristol - "Lessons From Test Code" with Jon Jagger
25.10 C++ UG Saratov, Russia
29.10 C++ UG London - No topic yet.

And In the Beginning…—Tony DaSilva

We don't normally link to pleas to spam mass-email anyone, never mind Bjarne Stroustrup, but we just had to share this heartfelt plea because it would be Good for the World. (Sorry, Dr. Stroustrup!)

But even if you don't email him, read or re-read D&E. It's still quite current.

And In the Beginning...

by Tony DaSilva

From the article:

I’m on my second pass through Bjarne Stroustrup’s "The Design And Evolution Of C++". In the book...

CppCon 2014 videos online

From the CppCon blog:

2014 Videos Online

We are announcing the CppCon Channel on YouTube with the first uploads of our video from CppCon 2014.

Our first videos feature our three keynote presentations from Bjarne Stroustrup, Mark Maimone, and Mike Acton; as well as our opening and closing plenary sessions from Scott Meyers and Herb Sutter. 

Over the next few weeks we’ll be uploading videos of most of the conference sessions including panels, lightning talks, and over one hundred sessions from the six tracks that made up the core of our conference program. The first two of our regular session uploads are from Michael Caisse and Thomas Rodgers.

We’d like to thank the speakers for allowing these sessions to be recorded and shared and Bash Films for the production of these videos.

Quick Q: Why can noexcept generate faster code than throw()?—StackOverflow

Quick A: Because noexcept doesn't have to keep track of stack unwinding.

noexcept, stack unwinding, and performance

The following draft from Scott Meyers new C++11 book says (page 2, lines 7-21)

The difference between unwinding the call stack and possibly unwinding it has a surprisingly large impact on code generation. In a noexcept function, optimizers need not keep the runtime stack in an unwindable state if an exception would propagate out of the function, nor must they ensure that objects in a noexcept function are destroyed in the inverse order of construction should an exception leave the function. The result is more opportunities for optimization, not only within the body of a noexcept function, but also at sites where the function is called. Such flexibility is present only for noexcept functions. Functions with “throw()” exception specifications lack it, as do functions with no exception specification at all.

In contrast, section 5.4 of "Technical Report on C++ Performance" describes the "code" and "table" ways of implementing exception handling. In particular, the "table" method is shown to have no time overhead when no exceptions are thrown and only has a space overhead.

My question is this - what optimizations is Scott Meyers talking about when he talks of unwinding vs possibly unwinding? Why don't these optimizations apply for throw()? Do his comments apply only to the "code" method mentioned in the 2006 TR?

Fun with C++14 Lambdas at Silicon Valley Code Camp—Sumant Tambe

If you're going to SVCC'14, check out the C++ sessions:

Fun with C++14 Lambdas at Silicon Valley Code Camp

by Sumant Tambe

From the article:

Believe it or not, but the 9th Silicon Valley Code Camp is less than 2 weeks away and I can't wait to be at the largest software technology conference setup by developers for developers -- and here is the best part -- at no cost to the attendees. So far, there are 234 registered sessions, 7 technical tracks, and over 3100 registrations. So mark your calendar -- it's October 11th and 12th, Saturday and Sunday, as always.

C++ is hot again at SVCC and third year in a row there is a dedicated track for modern C++...

Variadic Templates—Feabhas

variadic-templates.PNGRecently on StickyBits, a nice primer on variadics:

Variadic Templates

by feabhas

From the article:

In this article we’re going to look at a new feature of templates in C++11 -- the concept of the variadic template.

Variadic templates allow us to create functions and classes, not only with generic types, but also a variable number of generic types.

If you haven’t been following along with the template articles, I’d suggest you read this article first before continuing.

A Grand Introduction: Stepanov introduces Stroustrup at CppCon—Tony DaSilva

Bulldozer00's appreciation for Alex Stepanov's introduction for Bjarne Stroustrup at CppCon. We already linked to the video last week -- but if you didn't watch it then, do yourself a favor and spend 6 minutes now getting your workweek off to a great start.

A Grand Introduction

by Tony DaSilva

From the article:

"We should not be ashamed of bits. We should be proud of them." -- Alex Stepanov

You may not interpret it in the same way as I did, but I found this cppcon conference introduction of Bjarne Stroustrup by programming scholar Alex Stepanov very moving...

Rapid prototyping and teaching ZeroMQ in C++ with biicode—Diego Rodriguez-Losada

From the biicode beta product blog:

Rapid prototyping and teaching ZeroMQ in C++ with biicode

by Diego Rodriguez-Losada

From the article:

Today, if you try to build the basic C++ client-server example that ZeroMQ provides in their site, you might encounter some problems. You have to guess that the C++ binding is not in the library, instead, it’s inside another repo (zmqcpp). I had to google it myself to find it. You have to get, configure and build the library, then setup your own project to use it.

The question is: Given some example source code snippets that use zmq, can anyone, even unexperienced developers build them quickly and easily, even without writing a single line of configuration, in any of the major OS? We think that it can be done, in a few simple steps...

Quick Q: Can computing the length of a C string really be compile-time constexpr?—StackOverflow

Quick A: Yes, when the string being traversed is itself a constant expression, such as a string literal.

Recently on StackOverflow:

Computing length of a C string at compile time. Is this really a constexpr?

I'm trying to compute the length of a string literal at compile time. To do so I'm using following code:

#include <cstdio>

int constexpr length(const char* str)
{
    return *str ? 1 + length(str + 1) : 0;
}

int main()
{
    printf("%d %d", length("abcd"), length("abcdefgh"));
}

Everything works as expected, the program prints 4 and 8. The assembly code generated by clang shows that the results are computed at compile time:

0x100000f5e:  leaq   0x35(%rip), %rdi          ; "%d %d"
0x100000f65:  movl   $0x4, %esi
0x100000f6a:  movl   $0x8, %edx
0x100000f6f:  xorl   %eax, %eax
0x100000f71:  callq  0x100000f7a               ; symbol stub for: printf

My question: is it guaranteed by the standard that length function will be evaluated compile time?

If this is true the door for compile time string literals computations just opened for me... for example I can compute hashes at compile time and many more...

A Conversation with Bjarne Stroustrup, Carl Hewitt, and Dave Ungar—Charles Torre

stroustrup-hewitt-ungar.PNGAn appetizer while the CppCon videos are being processed, we are pleased to link to this interview on Channel 9:

A Conversation with Bjarne Stroustrup, Carl Hewitt, and Dave Ungar

by Charles Torre

What happens when you put three titans of programming language design and computing in a room and turn a camera on to capture what takes place?

That's the thought experiment that led to this conversation with C++ language creator Bjarne Stroustrup, Self language creator Dave Ungar, and actor model creator Carl Hewitt. Thank goodness all three of them were present at Lang.NEXT 2014. Many topics are covered, as you can imagine. It's best that you find some quality time to watch, listen, and learn from some true masters. This is a long conversation and there is great programming history herein!

This is a rare (and very candid) gathering of some of the best minds in the programming world today.

Huge thanks to Bjarne, Carl, and Dave for spending over an hour to make conversation in real time. The topics naturally evolved out of the random and it was an honor to be in the room with such wonderful people who've had such a huge impact on programming.

Tune in. Enjoy.