News

C++ Compiler Benchmarks—Imagine Raytracer

On the blog Imagine Raytracer a few days ago:

C++ Compiler Benchmarks

by Imagine Raytracer

From the article:

[...] I decided to try 4.9.2 which had just been released. This seemed to showed a fairly serious regression in terms of speed (speed being a pretty important aspect for a renderer), so I decided I'd do a more comprehensive comparison of the latest main compilers for the Linux platform, as back in 2011 and 2012 I used to do compiler benchmarks (GCC, LLVM and ICC) regularly every six months or so on my own code (including Imagine), and on the commercial VFX compositor made by the company I worked for at the time, and it had been a while since I'd compared them myself...

LINQ-like List Manipulation in C++

Cross platform LINQ for C++ 

LINQ-like List Manipulation in C++

by Gaston Hillar

From the article:

When developers make the move from C# to C++, they definitely miss Language-Integrated Query (LINQ) features. Cpplinq is an excellent open-source project that uses C++11 features to provide extensible LINQ-like list manipulation to C++.

I'm sad to say Farewell Dr. Dobb's. Thank you for all the good articles.

Let’s play a game: Spot the bug in popular open-source projects—Andrey Karpov

[We don't often link to quiz-like sites, particularly product-specific ones, but in this case we felt that this could be of broad interest to some of our readers. -- Ed.]

 

The authors of the PVS-Studio analyzer invite you to test your attentiveness:

Let's play a game -- spot the bug in popular open-source projects

by Andrey Karpov

From the article:

Code analyzers never get tired and can find errors a human's eye cannot easily notice. We have picked a few code fragments with errors revealed by PVS-Studio, all the fragments taken from well-known open-source projects.

We invite you to take part in a competition against code analyzers to test your agility by trying to find the errors by yourself. You will be offered 15 randomly selected tasks. Every correct answer earns you one score if you give it within 60 seconds. The code fragments are short and 60 seconds is a fair limit.

Let's examine a couple of examples with errors for you to understand how to give the answer...

Note: This test does not currently support mobile devices. We are working on new version of tests with better mobile devices support, new problems to solve etc. However, it is not implemented yet. We offer you to subscribe on twitter to read about our new and interesting news and to read about new things in a C++ world.

The Evolving Search for Effective C++—Scott Meyers

Scott Meyers' keynote at the Meeting C++ 2014 conference. A short description can be found on 

the presenters blog.

The Evolving Search for Effective C++

by Scott Meyers

Description from the blog:

The video of my keynote address at Meeting C++ 2014 on December 5 has just been posted to the Meeting C++ Channel at YouTube. I was given a long time slot (two hours), so I addressed two rather different topics, both based on my work of the past quarter century identifying and promulgating guidelines for effective C++ programming...

biicode 2.0 is out—biicode Team

biicode, a C++ dependency manager, releases version 2.0

biicode 2.0 is out

by biicode Team

Who's biicode for?

For C/C++ developers that think a dependency manager is needed, biicode is a multiplatform tool and hosting service that allows you to build your projects easily, integrate third party code and reuse code among projects with just #includes.

 

Software Duct Tape: Binding the C++  Universe Together—Glennan Carnie

In case you missed it last week on Sticky Bits:

Software Duct Tape -- Binding the C++  Universe Together

by Glennan Carnie

From the article:

One of the cornerstones of object-oriented design is the concept of objects interacting by sending messages to form mechanisms – units of higher-order (or ‘emergent’) behaviour.

In order to send a message (in this case, invoke a member function) an object must have a ‘link’ to the target object. That link is formed by building in an association between the two classes as part of the type’s definition.

In this article we look at building associations between classes and forming run-time links so objects can communicate...

Lessons to learn from John Carmack and Oculus [about] the “Modern C++” approach—CoderGears Team

Fresh on CoderGears:

Lessons to learn from John Carmack and Oculus development team when using the “Modern C++” approach

by CoderGears Team

From the article:

In the previous post about Doom3, we discovered that it was developed using the “C with Classes” approach. John Carmack is the main developer and it was between 2000 and 2004, what explains why “Modern C++” approach was not adopted. And, even if “C with Classes” is not recommended, he made some good decisions to have clean code.

John Carmack is now the oculus VR CTO, Oculus VR is an American virtual reality technology company founded by Palmer Luckey and Brendan Iribe. Their first product, still in development, is the Oculus Rift, a head-mounted display for immersive virtual reality (VR).

Oculus provides an SDK which includes its source code, it’s developed using C++.  For this project the Modern C++ approach was adopted. Let’s discover some design and implementation choices of John Carmack and his team...

Quick Q: What is constexpr useful for?—StackOverflow

Quick A: When you need the constant to be available at compile time.

Today on SO:

What are 'constexpr' useful for?

I really can't find any use of it. My first idea was that I could use it to implement 'Design by Contract' without using macros like this:

struct S
{  
    S(constexpr int i) : S(i) { static_assert( i < 9, "i must be < 9" ); }

    S(int i); //external defintion

    char *pSomeMemory;
};

But this wouldn't compile. I thought we could also use it to reference same-variable without the need of additional memory to be created when we want to avoid the get/setters in order to make instances to one member from users to be read-only:

class S
{ 
private:
    int _i;

public:
    const int & constexpr i = _i;
};

But none of the above actually compiled. Can someone give me some insight why this keyword was being introduced?

Using assertions—Andrzej KrzemieĊ„ski

Today on Andrzej's blog:

Using assertions

by Andrzej Krzemieński

From the article:

This post is a response to my recent encounters with fellow programmers who appear to me to be missing the point of assertions and fail to appreciate their usefulness. The first post I have ever written here was on assertions, I still find it good, so there is no need to repeat it; here I will only describe how I observe people treat assertions and why I believe it is wrong.

I am reviewing the following code...