October 2014

C++ and Zombies: a moving question

One of the issues I was thinking about since C++Now: move and move-destruction

C++ and Zombies: a moving question

by Jens Weller

From the article:

This has been on my things to think about since C++Now. At C++Now, I realized, that we've might got zombies in the C++ standard. And that there are two fractions, one of them stating, that it is ok to have well defined zombies, while some people think that you'd better kill them.

Introduction to Modern C++ -- Olve Maudal

A few days ago in Norway, well-known C++ expert Olve Maudal presented the following slides. We hope you enjoy them too.

Introduction to Modern C++ (PDF)

by Olve Maudal

From the presentation:

C++ has evolved a lot since it was first introduced as "C with classes" with primitive support for object-oriented programming. In particular during the last 10-15 years the common use of the language has changed "dramatically" and the language itself has evolved accordingly. Modern C++ (C++11/14) is still very suitable for object-oriented programming, but now the language also provides good support for generic programming and functional programming. All of this while C++ is still a low-level language that can be used to create programs that compete with programs written in assembler both in terms of speed and size.

We start with a brief history of C++ before focusing on new features in C++11/14 and a demonstration of some typical modern programming techniques.

Stroustrup highlights next C++ goals: Parallelism, concurrency -- Paul Krill

infoworld2.PNGToday in Infoworld, perhaps the first article about C++17:

Stroustrup highlights next C++ goals: Parallelism, concurrency

Language founder Bjarne Stroustrup gives early indicators of what to expect in C++17

by Paul Krill

Note: C++14 is just being published and C++17 may sound far away. But it's not -- some compilers, such as Clang 3.5 and Visual C++ "14" CTP, already go beyond C++14 and support draft-C++17 features like the new for(e:v) syntax.

From the article:

... Other major proposals for C++17 include faster compilation (championed mostly by Apple, Google, and Microsoft), contracts, and better type-checking. A meeting about the future of C++ is to be held by the standards committee at the University of Illinois, Urbana-Champa[ign], next week, Stroustrup says.

Second Edition of "The Boost C++ Libraries" Now in Print and Online

boost-schaeling.jpgThe second edition of Boris Schäling's "The Boost C++ Libraries" is now available in print form and (free) online. The print edition is available at Amazon and the online version is here

This edition covers 72 Boost libraries, almost twice as many as the previous edition and uses 430 complete, but as short as possible code examples.

For Boost libraries that were incorporated into the C++11 standard library, differences between Boost and the standard library are highlighted.

The goal of this book is to increase your efficiency as a C++ developer and to simplify software development with C++. The Boost libraries introduced in this book will help you write less code with fewer bugs and finish projects faster. Your code will be more concise and self-explanatory and more easily adapted when requirements change.

 

A very special Sponsorship: CppCon and the Standard C++ Foundation -- Jens Weller

Jens Weller has been doing an awesome job in Europe for the past several years, both in helping to found new C++ user groups and in putting on the really great Meeting C++ conference.

Such good work deserves to be supported, and so we're pleased to report that CppCon and the Standard C++ Foundation have agreed to be an ongoing sponsor of Meeting C++ -- in 2014 and beyond:

A very special Sponsorship: CppCon and the Standard C++ Foundation

by Jens Weller

From the article:

Today I can announce a very special sponsorship: CppCon and the Standard C++ Foundation has joined Meeting C++ as a long time sponsor! The Standard C++ Foundation is for this and the coming years the keynote sponsor for Meeting C++, last year this was BlackBerry.

Back in 2012, Meeting C++ and isocpp.org, the Standard C++ Foundation's website, got started. Both share a common goal: to support C++ and its community. Meeting C++ has helped the founding of a European network for C++, growing from 2 user groups in 2011 to 25 user groups in 2014. With isocpp.org, CppCon and Meeting C++ we want to bring this now to a global level.

Which brings me to what role CppCon has in this sponsorship. The CppCon is the official conference of the Standard C++ Foundation, and similar to Meeting C++ it is a great, community driven C++ Conference. Both share to have their roots in C++Now. While I was at CppCon, people already recognized Meeting C++ as its European counter part. But Europe has a very versatile C++ conference scene, with usingstdcpp in Madrid, Accu in Bristol, ADC in Bavaria, NDC next year in London, and Meeting C++ in Berlin. So Europe has a vivid and growing scene of C++ conferences!

So CppCon and the Standard C++ Foundation is now a long time Keynote & Platinum Sponsor of Meeting C++!

I also asked Herb Sutter about a statement why the Standard C++ Foundation and CppCon is sponsoring Meeting C++, so here is Herb's statement:

CppCon and the Standard C++ Foundation want to support Meeting C++’s great work of fostering C++ in Europe, from the Meeting C++ conference itself to its with incubating and encouraging a growing number of C++ user groups all across Europe.
 

Bjarne Stroustrup "Make Simple Tasks Simple!" at CodeRage 9 -- Wed Oct 29, 9-11am PDT

Don't forget to tune in tomorrow morning, North American Pacific time, as the CodeRage conference will replay the CppCon "Make Simple Things Simpler!" keynote and take live Q&A with the keynoter, Bjarne Stroustrup:

Bjarne Stroustrup "Make Simple Tasks Simple!" at CodeRage 9 -- Wednesday, Oct. 29: 9-11am PDT

by David Intersimone

From the article:

... This time we will be doing things a little bit differently. We will watch a replay of Bjarne's wonderful CppCon 2014 Keynote, "Make Simple Tasks Simple!", and then have a live Q&A with Bjarne to complete the 2 hour session. [This] will take place on Wednesday, October 29 from 9am to 11am Pacific Time (12noon to 2pm Eastern Time) on the C++ track live stream.

... You can submit questions live during the session or you can email questions in advance by sending them to davidi at embarcadero dot com using the subject line "Ask Bjarne during CodeRage 9".

Why a "file based" dependency manager rocks for C/C++

C/C++ file-based dependency manager

Biicode is a file based dependency manager for C++. That lets amazing things to happen, such as allowing to reuse individual files from previous projects without having to worry about packaging, setup or installs. Biicode tracks which files depends on which files, and use it to automatically define build targets, or manage dependencies accordingly. For example, you could just reuse the “Person” object from another project, and you will not depend on the other project's dependencies at all, as those files do not depend on them. And this is only the beginning, with this file based approach you can also do many other amazing things, stay tuned for next posts. We believe this is indeed a new paradigm for dependency management. We are still in beta, releasing based on our users feedback almost every week, towards such a system that could rock for all of us as developers. That means that we are not perfect, as I told you we are working hard and defining the best possible roadmap for our community, including open-sourcing the code and building all the necessary tools for production environments.

Help us improve, try it out

Template Metaprogramming with Modern C++: Templates in Depth -- Manu Sánchez

Template Metaprogramming Modern C++ in biicode

Recently on biicode:

Template Metaprogramming with Modern C++: Templates in Depth

by Manu Sánchez

From the article:

The last time  we learnt what metaprogramming was, how metaprogramming in C++ via templates works, and the functional spirit of the embedded language that C++ template metaprogramming is. In this post we will learn C++ templates in depth: Class and function templates, template parameters, variadic templates, all with in depth examples. ...

 

... Then the fact that the compiler only generates code which actually does something (All syntactic sugar that high-level constructs provide is thrown away):

int main()
{
    return Fibonacci<5>::value;
}

GCC 4.9 -std=c++11 -O0 x86 target:

main:                                   # @main
	movl	$55, 

Variadic Templates in C++ -- Eli Bendersky

plusprofilephoto.pngA nice tutorial on a feature that leads to convenient and safe calling code:

Variadic Templates in C++

by Eli Bendersky

From the article:

Prior to C++11, the only way to write functions that take an arbitrary number of arguments was to use variadic functions like printf, with the ellipsis syntax (...) and the accompanying va_ family of macros. If you've ever written code using this approach you know how cumbersome it is. In addition to being type unsafe (all type resolution has to be done explicitly with casts in va_arg, at runtime), it's also tricky to get right. The va_ macros perform low-level memory manipulation, and I've seen a lot of code that segfaults because it isn't using them carefully enough.

But what always bothered me most with this approach is leaving something that is clearly known at compile-time, to run-time. Yes, when we write a variadic function we don't know all the ways it's going to be used. But when the compiler puts the whole program together, it does know. It sees perfectly well all the invocations of the function throughout the program, and all the possible argument types it gets passed (types are, after all, resolved at compile-time in C++).

Variadic templates

One of the new features of C++11 is variadic templates. Finally, there's a way to write functions that take an arbitrary number of arguments in a type-safe way and have all the argument handling logic resolved at compile-time, rather than run-time. Variadic templates can be used for much more than just functions that take an arbitrary number of arguments; in this article I want to demonstrate some of these capabilities...