Despite the name, perfect forwarding is not so perfect. In the following example, a class B is constructed by passing a : struct A { int x, y; }; struct B { B(A a) { /*…*/ } }; int main() { B b1({1, 2}); } Everything’s ok: {1, 2} is deduced to be the …
Continue reading Not-so-perfect forwardingGCC
This post is also available in Italian. As stated in a previous post, final keyword enables the sealing of classes and methods. This is important because it allows interesting compile-time checks, but also enables quite a powerful optimization: the devirtualization. Devirtualization happens when the compiler can statically decide, at compile time, which function should be called, so it can produce …
Continue reading The power of devirtualizationLast month I bought a bunch of Raspberry PI 2 and started playing with them. I was a bit disappointed about the lack of modern tools in the standard Raspbian Wheezy distro, but I found out that Debian 8.0 (Jessie) is more advanced on that, but the process of downloading the image, modifying the files, …
Continue reading Using Raspberry PI 2 as a C++11/14 playground