January 2015

Schedule for ACCU 2015 has been published

The schedule for the annual ACCU Conference has just been published. The conference will be held at Marriott Hotel City Centre, in Bristol, UK, on April 21-25, 2015. The conference is focused on professionalism in programming, but as always the schedule contains a lot of talks about C++.

ACCU is a small and friendly conference, typically 300-400 attendees living together in the same hotel for a week discussing everything about programming. Most of the talks are 90 minutes, with long breaks inbetween, inviting to deep and insightful discussions both during and after the sessions. If you are into programming, especially C++, this is a conference that you might want to consider.

Defensive Programming -- Andrzej KrzemieĊ„ski

Note that the questions raised are good ones even if we would normally use & parameters for the non-null case.

Today on Andrzej's blog:

Defensive programming

by Andrzej Krzemieński

From the article:

Have you ever asked yourself, or participated in a discussion on whether “defensive programming”is a good or a bad thing? The issue is controversial, and recently, while watching talk “Defensive Programming Done Right, Part I” by John Lakos, I realized (I think) why. Term “undefined behavior” means different things to different people...

Discriminated Unions with boost::python and boost::variant - The Blind Guru

A useful application of boost::variant with boost::python by Mario Lang.

boost::python and boost::variant

by Mario Lang

From the post:

However, there is one aspect of C++ data types that I couldn't figure out how to interface with Python, which are C++ discriminated unions, or more specifically, heterogeneous containers. While Python has no problems with containers containing objects of different types, C++ does not make this very easy by default.

More C++ Idioms -- WikiBooks

This is a catalog of reusable pieces of C++ knowledge, similar to the book on design patterns by GoF.

[An interesting experiment... Note that some material is dated, but it's a wiki. -- Ed.]

More C++ Idioms

C++ has indeed become too "expert friendly" -- Bjarne Stroustrup, The Problem with Programming, Technology Review, Nov 2006.

Stroustrup's saying is true because experts are intimately familiar with the idioms in the language. With the increase in the idioms a programmer understands, the language becomes friendlier to him or her. The objective of this open content book is to present modern C++ idioms to programmers who have moderate level of familiarity with C++, and help elevate their knowledge so that C++ feels much friendlier to them. It is designed to be an exhaustive catalog of reusable idioms that expert C++ programmers often use while programming or designing using C++. This is an effort to capture their techniques and vocabulary into a single work. This book describes the idioms in a regular format: Name-Intent-Motivation-Solution-References, which is succinct and helps speed learning. By their nature, idioms tend to have appeared in the C++ community and in published work many times. An effort has been made to refer to the original source(s) where possible; if you find a reference incomplete or incorrect, please feel free to suggest or make improvements.

The world is invited to catalog reusable pieces of C++ knowledge (similar to the book on design patterns by GoF). The goal here is to first build an exhaustive catalog of modern C++ idioms and later evolve it into an idiom language, just like a pattern language. Finally, the contents of this book can be redistributed under the terms of the GNU Free Documentation License.

Aimed toward: Anyone with an intermediate level of knowledge in C++ and supported language paradigms

 

Generating OpenCL/CUDA source code from C++ expressions in VexCL

A solution to generate code for CUDA and OpenCL with C++:

Generating OpenCL/CUDA source code from C++ expressions in VexCL

by Denis Demidov

From the talk description:

VexCL is an opensource C++ vector expression template library for OpenCL/CUDA. It has been created for ease of GPGPU development with C++ and provides convenient and intuitive notation for linear algebra operations, vector arithmetic and various parallel primitives.

Await, coroutines, what could that bring for game development

[This article is interesting not only because it's about work being proposed for consideration in the Concurrency TS, but also because it's interesting that we seem to be seeing a trend of articles being published on GitHub instead of on a blog... --Ed.]

 

Await, coroutines, what could that bring for game development

This article shows how we can use await in way not related to threading, tasks, or asynchronous I/O, but in the context of a game, to write game logic-related code spanning accross many frames in a sequencial way, without introducing any threads with little to no performance penalty.

Ask the STL Creator about Generic Programming

An online (Slashdot) interview of Alexander Stepanov and Daniel Rose, authors of "From Mathematics to Generic Programming" is now soliciting questions.

Add a reply to this Slashdot announcement to pose a questions. Ask as many questions as you'd like, but only one question per reply please:

Interview: Ask Alexander Stepanov and Daniel E. Rose a Question

An anonymous reader writes:

"Alexander Stepanov studied mathematics at Moscow State University and has been programming since 1972. His work on foundations of programming has been supported by GE, Brooklyn Polytechnic, AT&T, HP, SGI, and, since 2002, Adobe. In 1995 he received the Dr. Dobb's Journal Excellence in Programming Award for the design of the C++ Standard Template Library. Currently, he is the Senior Principal Engineer at A9.com. Daniel E. Roseis a programmer and research scientist who has held management positions at Apple, AltaVista, Xigo, Yahoo, and is the Chief Scientist for Search at A9.com. His research focuses on all aspects of search technology, ranging from low-level algorithms for index compression to human-computer interaction issues in web search. Rose led the team at Apple that created desktop search for the Macintosh. In addition to working together, the pair have recently written a book, From Mathematics to Generic Programming. Alexander and Daniel have agreed to answer any questions you may have about their book, their work, or programming in general. As usual, ask as many as you'd like, but please, one per post."

Multiplatform C++ - Edouard Alligand @ Meeting C++ 2014

The latest version of Edouard Alligands talk on Multiplatform development with C++:

Multiplattform C++

by Edouard Alligand

From the talk description:

C++ is a multiplatform language, yet many difficulties arise when you want the same code to compile properly and function identically on different platforms. If you put aside the obvious system programming related obstacles, and the differences you might have between compilers (especially when it comes to supporting C++11 and C++14), you come to the surprising conclusion that what is truly hard is all the “little things” you didn’t anticipate.

Quick Q: Why does trying to use a std::move'd object try to copy? -- StackOverflow

Quick A: Think of move is (mostly) an optimization of copy, and copy as the "slow" fallback when you can't actually move.

Fresh on SO:

Why does calling std::move on a const object call the copy constructor when passed to another object?

Specifically, the code

#include <iostream>

struct Foo {
    Foo() = default;
    Foo(Foo && x) { std::cout << "Move" << std::endl; }
    Foo(Foo const & x) = delete;
};

int main() {
    Foo const x; Foo y(std::move(x));
}

fails to compile with the message:

g++ -std=c++14 test07.cpp -o test07
test07.cpp: In function 'int main()':
test07.cpp:10:36: error: use of deleted function 'Foo::Foo(const Foo&)'
     Foo const x; Foo y(std::move(x));
                                    ^
test07.cpp:6:5: note: declared here
     Foo(Foo const & x) = delete;
     ^
Makefile:2: recipe for target 'all' failed
make: *** [all] Error 1

Certainly, I expect it to fail because we can't move a const value. At the same time, I don't understand the route that the code takes before it tries to call the copy constructor. Meaning, I know that std::move converts the element to an x-value, but I don't know how things proceed after that with respect to const.