Quick Q: Does C++ final imply final in all aspects?

Quick A: Yes, a final class cannot have its methods overriden.

Recently on SO:

Does C++ final imply final in all aspects?

To quote the draft C++ standard from here [class.virtual/4]:

If a virtual function f in some class B is marked with the virt-specifier final and in a class D derived from B a function D::f overrides B::f, the program is ill-formed.
And here [class/3]:
If a class is marked with the class-virt-specifier final and it appears as a base-type-specifier in a base-clause (Clause [class.derived]), the program is ill-formed.
So, in answer to the question;

 

Does a final class implicitly imply its virtual functions to be final as well? Should it? Please clarify.

So, at least not formally. But attempts to violate either rule will be the same result in both cases; the program is ill-formed and so won't compile. A final class means the class cannot be derived from, so as a consequence of this, its virtual methods cannot be overridden.

 

Should it? Probably not, they are related but they not the same thing. There is also no need formally require the one to imply the other, the effect follows naturally. Any violations have the same result, a failed compile (hopefully with appropriate error messages to distinguish the two).

GCC 6.1 Released

After slightly more than a year since last major GCC release, the GCC project is proud to announce the new major GCC release, 6.1.

GCC 6.1 Released

by the GCC project

From the article:

GCC 6.1 is a major release containing substantial new functionality not available in GCC 5.x or previous GCC releases.

The C++ frontend now defaults to C++14 standard instead of C++98 it has been defaulting to previously, for compiling older C++ code that might require either explicitly compiling with selected older C++ standards, or might require some code adjustment, see http://gcc.gnu.org/gcc-6/porting_to.html for details. The experimental C++17 support has been enhanced in this release.

This releases features various improvements in the emitted diagnostics, including improved locations, location ranges, suggestions for misspelled identifiers, option names etc., fix-it hints and a couple of new warnings have been added.

The OpenMP 4.5 specification is fully supported in this new release, the compiler can be configured for OpenMP offloading to Intel XeonPhi Knights Landing and AMD HSAIL. The OpenACC 2.0a specification support has been much improved, with offloading to NVidia PTX.

The optimizers have been improved, with improvements appearing in all of intra-procedural optimizations, inter-procedural optimizations, link time optimizations and various target backends.

See  https://gcc.gnu.org/gcc-6/changes.html for more information about changes in GCC 6.1.

This release is available from the FTP servers listed here: http://www.gnu.org/order/ftp.html

The release is in gcc/gcc-6.1.0/ subdirectory.

If you encounter difficulties using GCC 6.1, please do not contact me directly. Instead, please visit http://gcc.gnu.org for information about getting help.

Driving a leading free software project such as GNU Compiler Collection would not be possible without support from its many contributors. Not to only mention its developers but especially its regular testers and users which contribute to its high quality.  The list of individuals is too large to thank individually!

Quick Q: Need of a weak_ptr in C++11

Quick A: To keep a pointer on a ressource without owning it.

Recently on SO:

Need of a weak_ptr in C++11

The second half of that statement should be clear: if a pointer is not an owning pointer then the object it is pointing at might be deleted by whatever software is the owner - and then you'd have the standard dangling reference.

So this issue is: you've got objects owned by some piece of software which is letting other software have access to it - but the other software won't share the ownership. So the owner can delete it at any time and the other software needs to know it's pointer is no longer valid.

Maybe an example would help:

You've got some piece of software watching a camera pointing out your window to a bird feeder and it is identifying birds at the feeder, which come and go. Each bird at the feeder has an object created by this software when it arrives at the feeder, and the object is deleted when the bird flies away.

Meanwhile, some other software it taking a census. Every 10 seconds it grabs from the feeder-watching software a collection of the birds at the feeder. Every 100 seconds it emits a report of which birds were at the feeder for the entire 100 seconds.

Because the data for a bird is big the census-taker doesn't copy the data. It merely gets, every 10 seconds, a collection of pointers from the feeder-watcher.

To make it necessary to use weak pointers, let's say the feeder-watcher only provides pointers to birds which have arrived in the last ten seconds, not the ones which have been there. That is, there is no notification that birds have disappeared.

By using weak pointers it can know, at report time, which of the birds are still there, and when they arrived (but not when they left).

(Maybe I'll think of a better example later.)

build2 0.3.0 Released, Adds High Fidelity Builds

build2 is an open source, cross-platform toolchain for building and packaging C++ code. It includes a build system, package manager, and repository web interface. There is also cppget.org, a public repository of open source C++ packages.

build2 0.3.0 Release Notes

From the announcement:

This release includes a number of new features in the build system (high fidelity builds, command line configuration overrides), package manager (support for dropping no longer necessary packages), and repository web interface (ability to run multiple instances, look and feel customizations).

New “Italian C++ Conference” event in Italy (Italian only)

A full day of C++ in the Italian language:

Italian C++ Conference 2016

May 14, 2016

University "Bicocca", in Milan.

Special guest: James McNellis, from the Visual C++ Team.

The site and the event are entirely in Italian. Here is a translation of the main information:

In a nutshell

The Italian C++ Conference 2016 aims to be a forum for exchanging experiences using the C++ language, paying special attention to what we learned in the last years using C++11 and C++14, and what to expect from the upcoming C++17.

James McNellis will talk (in English!) about CoRoutines and CRT refactoring.

Other Italian C++ professionals will speak (in Italian) on different topics.
 

Who should attend the Italian C++ Conference 2016?

This event is made by C++ professionals for C++ professionals, students and enthusiasts.

 

What can I find in the Italian C++ Conference 2016?

After 5 years of C++11, we'll show the picture of the situation through real stories.

The agenda consists of 5x60' tech talks and 1x40' Q/A "Ask Us Everything" panel.

James McNellis will talk about CoRoutines and about his experience on redesigning the C Runtime (CRT).

Other speakers are Italian C++ professionals, working in different domains. They will cover topics like C++ simplification, REST and Websocket, ideas for teaching modern C++.

Coffee breaks and lunch included.

You can refer to the detailed program for more information.
 

When does the Italian C++ Conference 2016 take place?

The event will be held on May 14, 2016 at the University "Bicocca", in Milan.

Check-in starts at 8.30 AM, the main event starts at 9.00 AM and will last for a full day.
 

Who supports this event?

RogueWave Software is our main sponsor.

JetBrains and O'Reilly are supporting us with free books/licenses.

Get in touch if you want to support us!
 

Do I need to register?

The Italian C++ Conference 2016 is free, but you must register to facilitate the organization of the event. You can register here.

Fast incremental sort -- Lars Hagen

Lars Hagen describes in his blog post a strategy to solve the problem of a fast incremental sort.

Fast incremental sort

by Lars Hagen

From the article

I recently came across the need for an incremental sorting algorithm, and started to wonder how to do it optimally.

The incremental sorting problem is described here, and is an “online” version of partial sort. That is, if you have already sorted kk elements, you should be able to quickly sort k+1k+1 elements, and so on.

Incremental sorts can be useful for a number of cases:

  • You want sorted items, but you don’t know how many elements you’ll need. This could often happen when you are filtering the resulting sequence, and you don’t know how many items will be filtered out.
  • You are streaming the sequence, so even though you want the whole sequence, you want the first elements as quickly as possible.

We’ll see how branch misprediction and other constant factors can make the naive asymptotically optimal version far slower than a practical implementation.

CppCast Episode 54: VS for Linux with Ankit Asthana

Episode 54 of CppCast the only podcast for C++ developers by C++ developers. In this episode Rob and Jason are joined by Ankit Asthana to discuss new features for Visual Studio and VS Code. Including new support for Linux developers.

CppCast Episode 54: VS for Linux with Ankit Asthana

by Rob Irving and Jason Turner

About the interviewee:

Ankit Asthana is a program manager working in the Visual C++ Cross-Platform space. He is knowledgeable in cross-platform technologies, compilers (dynamic and static compilation, optimizer, code generation), distributed computing and server side development. He has in the past worked for IBM and Oracle Canada as a developer building Java 7 (hotspot) and telecommunication products. Ankit back in 2008 also published a book on C++ titled C++ for Beginners to Masters which sold over a few thousand copies.