Interview with Bjarne Stroustrup invested Doctor Honoris Causa at University Carlos III of Madrid

On January 25th 2019, Bjarne Stroustrup was invested as Doctor Honoris Causa at University Carlos III of Madrid (Spain).

Honorary Doctorates are the highest honor that a Spanish Univeristy gives to somebody for their merit in the academic, scientific or artistic fields of activity.

Interview with Bjarne Stroustup

by Daniel Garcia

About the interview

In this short interview Dr. Stroustrup talks about the C++ programming language, the reasons that lead to its inception, its impact and other related topics.

 

Template meta-functions for detecting template instantiation--Ivan Čukić

Templates are great.

Template meta-functions for detecting template instantiation

by Ivan Čukić

From the article:

I’ve been playing around with type meta-tagging for my Voy reactive streams library (more on that some other time) and realized how useful it is to be able to check whether a given type is an instantiation of some class template, so I decided to write a short post about it...

Quick Q: What is a lambda expression in C++11?

Quick A: A convenient way to create a functor.

Recently on SO:

What is a lambda expression in C++11?

C++ includes useful generic functions like std::for_each and std::transform, which can be very handy. Unfortunately they can also be quite cumbersome to use, particularly if the functor you would like to apply is unique to the particular function.

#include <algorithm>
#include <vector>

namespace {
  struct f {
    void operator()(int) {
      // do something
    }
  };
}

void func(std::vector<int>& v) {
  f f;
  std::for_each(v.begin(), v.end(), f);
}

If you only use f once and in that specific place it seems overkill to be writing a whole class just to do something trivial and one off...

Understanding GCC warnings--Martin Sebor

In detail.

Understanding GCC warnings

by Martin Sebor

From the article:

Most of us appreciate when our compiler lets us know we made a mistake. Finding coding errors early lets us correct them before they embarrass us in a code review or, worse, turn into bugs that impact our customers. Besides the compulsory errors, many projects enable additional diagnostics by using the -Wall and -Wextra command-line options. For this reason, some projects even turn them into errors via -Werror as their first line of defense. But not every instance of a warning necessarily means the code is buggy. Conversely, the absence of warnings for a piece of code is no guarantee that there are no bugs lurking in it...

A gentle introduction to jump threading optimizations--Aldy Hernandez

Your complier does magic.

A gentle introduction to jump threading optimizations

by Aldy Hernandez

From the article:

As part of the GCC developers‘ on-demand range work for GCC 10, I’ve been playing with improving the backward jump threader so it can thread paths that are range-dependent. This, in turn, had me looking at the jump threader, which is a part of the compiler I’ve been carefully avoiding for years. If, like me, you’re curious about compiler optimizations, but are jump-threading-agnostic, perhaps you’ll be interested in this short introduction...

Thanks for the memory (allocator)--Glennan Carnie

Unifying the types.

Thanks for the memory (allocator)

by Glennan Carnie

From the article:

One of the design goals of Modern C++ is to find new – better, more effective – ways of doing things we could already do in C++.  Some might argue this is one of the more frustrating aspects of Modern C++ – if it works, don’t fix it (alternatively: why use lightbulbs when we have perfectly good candles?!)

This time we’ll look at a new aspect of Modern C++:  the Allocator model for dynamic containers.  This is currently experimental, but has been accepted into C++20.

The Allocator model allows programmers to provide their own memory management strategy in place of their default library implementation.  Although it is not specified by the C++ standard, many implementations use malloc/free.

Understanding this feature is important if you work on a high-integrity, or safety-critical, project where your project standards say ‘no’ to malloc...

C++ Russia 2019: April 19-20, Moscow

C++ Russia 2019 will be held in Moscow, April 19–20, 2019.

Two days, three tracks and dozens of deep technical talks about C++: concurrency, performance, architecture, environment — all you need to make your code perfect.

C++ R​ussia 2019: Moscow, April 19–20, 2019

by Sergey Platonov

From the article:

Keynote by Nicolai Josuttis and Anton Polukhin.

Also at the conerence: Philip Nash, Valentin Ziegler, Ivan Čukić, Viktor Kirilov, Andrey Davydov, Alexander Granin and many others.

C++ Russia is not only talks, but also networking with hundreds of colleagues from Russia and Europe. Due to dedicated discussion zones, all the speakers have after their talks all the questions will be answered.

If you need to solve any practical issue right now — you can find Ask Expert zone and ask speakers to help you.

And in the evening you can participate in BoF-sessions where the most uncommon ideas are born.

One of track will be entirely in English.

 

 

 

CppDepend v2019.1 Released including Misra C++ Standard!

We are happy to inform you that CppDepend v2019.1 has been released and is now available for download! CppDepend allows architects and developers to analyze C and C++ code base, customizing your own coding rules, and facilitate refactoring and migration.

CppDepend v2019.1

by CppDepend

About the release:

includes important updates:

  • Misra C++ standard checks:  CppDepend 2019.1 provides now out of the box 90 MISRA guidelines to facilitate code safety, security, portability, and reliability.
  • Plugins execution optimization: in order to get the CppDepend results quickly, the execution of the plugins are now executed in asynchronous mode. Their results will be loaded as soon as the analysis is done.
  • Clang Tidy customization: The Clang tidy tool checks against many standards and guidelines which makes it very slow, To optimize its execution you can now change its command line arguments to check only what you want as guidelines.
  • (Improvement) Many bug fixes and improvements including SonarQube 7.6 compatibility.

Download and enjoy the new version of CppDepend now by clicking here.

Quick Q: Pointer to class data member “::*”

Quick A: a pointer that lets you access the value of the member of an instance.

Recently on SO:

Pointer to class data member “::*”

It's a "pointer to member" - the following code illustrates its use:

#include <iostream>
using namespace std;

class Car
{
    public:
    int speed;
};

int main()
{
    int Car::*pSpeed = &Car::speed;

    Car c1;
    c1.speed = 1;       // direct access
    cout << "speed is " << c1.speed << endl;
    c1.*pSpeed = 2;     // access via pointer to member
    cout << "speed is " << c1.speed << endl;
    return 0;
}

As to why you would want to do that, well it gives you another level of indirection that can solve some tricky problems. But to be honest, I've never had to use them in my own code.

Edit: I can't think off-hand of a convincing use for pointers to member data. Pointer to member functions can be used in pluggable architectures, but once again producing an example in a small space defeats me. The following is my best (untested) try - an Apply function that would do some pre &post processing before applying a user-selected member function to an object:

void Apply( SomeClass * c, void (SomeClass::*func)() ) {
    // do hefty pre-call processing
    (c->*func)();  // call user specified function
    // do hefty post-call processing
}

The parentheses around c->*func are necessary because the ->* operator has lower precedence than the function call operator.