basics

No Runtime Overhead -- Bulldozer00

sharedunique.pngA little nugget about the free-as-in-no-overhead-ness of unique_ptr and std::move:

No Runtime Overhead

by Bulldozer00

From the article:

Unless I really need shared ownership of a dynamically allocated object, which I haven’t so far, I stick to the slimmer and more performant std::unique_ptr. ...

What are the semantics of =delete? -- StackOverflow

The question, rephrased: Does =delete mean "make the compiler skip this function and keep looking," or "make this function unusable and make the caller fix their code" -- and why?

What's the exact semantics of a deleted function in C++11?

struct A
{
    A();

    A(const A&);
    A& operator =(const A&);

    A(A&&) = delete;
    A& operator =(A&&) = delete;
};

struct B
{
    B();

    B(const B&);
    B& operator =(const B&);   
};

int main()
{
    A a;
    a = A(); // error C2280

    B b;
    b = B(); // OK
}

My compiler is VC++ 2013 RC.

error C2280: 'A &A::operator =(A &&)' : attempting to reference a deleted function

I just wonder why the compiler doesn't try A& operator =(const A&); when A& operator =(A&&) is deleted?

Is this behavior defined by the C++ standard?

Papers for Chicago: Concurrency

The start of my series about the papers for the upcoming Chicago meeting, starting with C for Concurrency:

C++ Papers for Chicago: Part 1 -- Concurrency

by Jens Weller

From the article:

As I did write a series about the papers for Bristol, this is the start of the series for Chicago, as at the end of this month the C++ committee will meet again for standardization. I try to...

C++ Conferences This Fall

I've created a short overview over the C++ Conferences this Fall:

  • Going Native (Seattle, 4.th-6.9) SOLD OUT
  • International Workshop on OpenMP (Canberra (AU), 16-18.9)
  • (not a conference, but...) Fall ISO C++ meeting (Chicago, 23-28.9)
  • QtDevDays Europe (Berlin, 7th - 9.10)
  • QtDevDays US (San Francisco, 6th-8.11)
  • Meeting C++ 2013 (Düsseldorf, 8th-9.11)
  • C++ and Beyond (Snoqualmie Falls (WA/US), 9th-12.12) SOLD OUT

More details at Meeting C++

by Jens Weller

Revisiting the BlackBerry 10 NDK

I've been looking at the BlackBerry 10 NDK the last weeks, and did write about it to share some thoughts and results.

Revisiting the BlackBerry 10 NDK

by Jens Weller

From the article:

The last few weeks I did look again at the BlackBerry 10 NDK, as a client had asked for help and training. I offered to adapt my Qt Introduction course to the BlackBerry plattform, and offered my advice...

Before I start, a short paragraph about Apps and C++. People coming from Java or .NET often don't understand the need to make Apps in C++...

A Glimpse into C++14: Combine Flexibility and Performance with Dynamic Arrays and... -- Danny Kalev

cpp14-target.jpgDanny Kalev wrote a nice article yesterday about a new C++ feature -- actually, two related C++14 features -- that were just added to the draft Standard in April and will be coming to real compilers in the near future.

A Glimpse into C++14: Combine Flexibility and Performance with Dynamic Arrays and Runtime-Sized Arrays

by Danny Kalev

From the article:

C99 introduced the notion of variable length arrays: stack allocated built-in arrays whose size is determined at runtime. C++ lacks a similar feature, to the discontent of many a programmer. However, two recent proposals for adding dynamic arrays and runtime-sized arrays to C++14 are closing the gap at last. Learn how to use these new features to imitate C99’s variable length arrays in C++...

GotW #7a Solution: Minimizing Compile-Time Dependencies, Part 1—Herb Sutter

The solution to the latest GotW problem is now available. In this Item, the focus is on analyzing and managing compile-time dependencies.

    GotW #7a Solution: Minimizing Compile-Time Dependencies, Part 1

    by Herb Sutter

From the article:

Managing dependencies well is an essential part of writing solid code. C++ supports two powerful methods of abstraction: object-oriented programming and generic programming. Both of these are fundamentally tools to help manage dependencies, and therefore manage complexity. It’s telling that all of the common OO/generic buzzwords—including encapsulation, polymorphism, and type independence—along with most design patterns, are really about describing ways to manage complexity within a software system by managing the code’s interdependencies.

When we talk about dependencies, we usually think of run-time dependencies like class interactions. In this Item, we will focus instead on how to analyze and manage compile-time dependencies. As a first step, try to identify (and root out) unnecessary headers.

Guideline: Never #include unnecessary header files.

Guideline: Prefer to #include <iosfwd> when a forward declaration of a stream will suffice.

Guideline: Never #include a header when a forward declaration will suffice.

Continue reading...

Overload 116 available

overload-116.PNGOverload 116 is now available. It contains the following articles, and more:

 

Overload 116

Auto -- A Necessary Evil? Part 2 -- Roger Orr

When is the use of auto good, and when is it evil?

Dynamic C++, Part 2 -- Alex Fabijanic

Alex Fabijanic and Richard Saunders continue to explore dynamic solutions in C++.

Portable String Literals in C++ -- Alf Steinbach

How hard can it be to make a file in C++ with international text literals in its name? Alf Steinbach shows us how to write a file called π.recipe.

Hard Upper Limit on Memory Latency -- Sergey Ignatchenko

How low can latency really get?

 

... and more!