Announcing code::dive 2018

code::dive 2018 will be held in Wrocław (Poland), November 7-8, 2018.

Announcing code::dive 2018

by Adam Badura

From the article:

code::dive 2018, the fifth edition, will be held in Wrocław (Poland) on November 7-8, 2018.

Call for Papers is open until end of June 2018 -- register on the webpage.

C++Now Announces Closing Keynote by John Regehr

C++Now 2018 will be held in Aspen, May 6–11, 2018.

Closing Keynote Announced: John Regehr on Undefined Behavior and Compiler Optimizations

From the announcement:

John is a professor of computer science at the University of Utah, where his research group creates tools for making software more efficient and correct. One of his projects is Csmith, a tool that generates random C programs. Why? To test compilers, of course. Csmith has been used to find more than 500 previously unknown bugs in production-quality compilers.

John will share some of the insights he’s gained from his research into compilers.

He will discuss what undefined behavior means to the compiler and how compiler writers use it in surprising ways generate better code.

 

Parallel Coding: From 90x Performance Loss To 2x Improvement--"No Bugs" Hare

Part 2!

Parallel Coding: From 90x Performance Loss To 2x Improvement

by "No Bugs" Hare

From the article:

In my previous post, we have observed pretty bad results for calculations as we tried to use mutexes and even atomics to do things parallel. OTOH, it was promised to show how parallel <algorithm> CAN be used both correctly and efficiently (that is, IF you need it, which is a separate question); this is what we’ll start discussing within this post...

Quick Q: Why does unary operator & not require a complete type?

Quick A: It only need to take the address.

Recently on SO:

Why does unary operator & not require a complete type?

What if stru has overloaded operator&()?

Then it is unspecified whether the overload will be called (See Oliv's comment for standard quote).

How could unary operator & does not require a complete type?

That's how the standard has defined the language. The built-in address-of operator doesn't need to know the definition of the type, since that has no effect on where to get the address of the object.

One consideration for why it is a good thing: Compatibility with C.

Trip report: Winter ISO C++ standards meeting (Jacksonville)--Herb Sutter

Lots of things happened.

Trip report: Winter ISO C++ standards meeting (Jacksonville)

by Herb Sutter

From the article:

On Saturday March 17, the ISO C++ committee completed its winter meeting in Jacksonville, Florida, USA, hosted with thanks by the Standard C++ Foundation and Perennial. We had some 140 people at the meeting, representing 8 national bodies. As usual, we met for six days Monday through Saturday, including all evenings...

Quick Q: Why does shared_ptr needs to hold reference counting for weak_ptr?

Quick A: To know when to deallocate the control block.

Recently on SO:

Why does shared_ptr needs to hold reference counting for weak_ptr?

The reference count controls the lifetime of the pointed-to-object. The weak count does not, but does control (or participate in control of) the lifetime of the control block.

If the reference count goes to 0, the object is destroyed, but not necessarily deallocated. When the weak count goes to 0 (or when the reference count goes to 0, if there are no weak_ptrs when that happens), the control block is destroyed and deallocated, and the storage for the object is deallocated if it wasn't already.

The separation between destroying and deallocating the pointed-to-object is an implementation detail you don't need to care about, but it is caused by using make_shared.

If you do

shared_ptr<int> myPtr(new int{10});

you allocate the storage for the int, then pass that into the shared_ptr constructor, which allocates storage for the control block separately. In this case, the storage for the int can be deallocated as early as possible: as soon as the reference count hits 0, even if there is still a weak count.

If you do

auto myPtr = make_shared<int>(10);

then make_shared might perform an optimisation where it allocates the storage for the int and the control block in one go. This means that the storage for the int can't be deallocated until the storage for the control block can also be deallocated. The lifetime of the int ends when the reference count hits 0, but the storage for it is not deallocated until the weak count hits 0.

Is that clear now?

Announcing Meeting C++ 2018

The details for Meeting C++ 2018:

Announcing Meeting C++ 2018

by Jens Weller

From the article:

Meeting C++ returns with its 2018 conference edition! Like in the previous years, we'll be meeting in Berlin from the 15. - 17th November!

Call for Talks will start soon, just as last year, Meeting C++ 2018 has a track for new speakers!

GoingNative 65: ISO C++ @ Jacksonville Debriefing--Augustin Popa

Another is out!

GoingNative 65: ISO C++ @ Jacksonville Debriefing

by Augustin Popa

From the video:

We are back quickly after our last episode to go over the latest news from the ISO C++ Standards Committee meeting in Jacksonville, Florida! C++20 planning is well on its way now as Steve Carroll chats with Gabriel Dos Reis and Gor Nishanov about new progress with C++ Modules, Coroutines, and more!

Some coroutine-related papers accepted for a future version of the C++ standard (provides more context on the code shared in the video):

  • Symmetric control transfer
  • Parameter preview