Examples of errors that PVS-Studio found in LLVM 15.0

Compilers are evolving: they issue more and more warnings. Do developers still need to use static code analyzers like PVS-Studio? Yes, because analyzers are evolving too. In this article you'll see how PVS-Studio can find bugs even in a compiler.

Examples of errors that PVS-Studio found in LLVM 15.0

by Andrey Karpov

From the article:

It's a cool bug, although it's not scary. There is no semicolon after the return statement. As a result, the code does not work as it looks.

void FunctionLoweringInfo::ComputePHILiveOutRegInfo(const PHINode *PN) {
  ....
  Register DestReg = It->second;
  if (DestReg == 0)
    return
  assert(Register::isVirtualRegister(DestReg) &&
         "Expected a virtual reg");
  LiveOutRegInfo.grow(DestReg);
  ....
}

Improving copy and move elision - Bran Hagger

improving-copy-and-move-elision.pngFrom the MSVC team blog:

Improving copy and move elision

by Bran Hagger

From the article:

With Visual Studio 2022 version 17.4 Preview 3, we’ve significantly increased the number of situations where we do copy or move elision and given users more control over whether these transformations are enabled. ...

PVS-Studio 7.21: GitLab Code Quality, Unreal Engine

PVS-Studio 7.21 has been released. This short note describes the analyzer's main enhancements and lists our recent articles and quizzes.

PVS-Studio 7.21: GitLab Code Quality, Unreal Engine

by Sergey Vasiliev

From the article:

New C++ diagnostics:

  • V1090. The 'std::uncaught_exception' function is deprecated since C++17 and is removed in C++20. Consider replacing this function with 'std::uncaught_exceptions'.
  • V1091. The pointer is cast to an integer type of a larger size. Casting pointer to a type of a larger size is an implementation-defined behavior.
  • V1092. Recursive function call during the static/thread_local variable initialization might occur. This may lead to undefined behavior.

ACCU 2023 Call for Papers is open -- ACCU

The ACCU is now putting together its program, and they want you to speak on C++. The ACCU conference has strong C++ tracks, though it is not a C++-only conference. If you have something to share, check out their

Call for PapersACCU 2023 Logo

by the ACCU

About the conference:

The ACCU 2023 conference will be from 2023-04-19 to 2023-04-22, with pre-conference workshops on 2023-04-17 and 2023-04-18.

The ACCU 2023 will be a hybrit event.

Historically, ACCU has a lot of C++ and C content, and is proud of that: ACCU is the foremost annual conference for people interested in C++ and C, at least in and around the UK. But it is not just a C++ and C conference, ACCU is about programming in whatever language people are using, with whatever tools and processes people are using: D, Chapel, Java, Kotlin, C#, F#, Groovy, Rust, Go, Python, Ruby, Lisp, to name just a few programming languages about which there have been sessions at ACCU conferences. Git, Mercurial, CMake, Meson, TDD, BDD, all these tools and techniques have been the focus of sessions at ACCU. The ACCU Conference is looking for sessions that will be interesting to people who create software.
The ACCU Conference is put on by ACCU (https://accu.org), but is open to anyone who wishes to be there either as a presenter or an attender.

The Call for Papers lasts for about 3 weeks and will close on Monday 7th November 2022 at 23:59:59 GMT.

The Bridge Pattern -- Rainer Grimm

Of Bridges and Pimpls:

The Bridge Pattern

by Rainer Grimm

From the article:

In C++, a simplified version of the Bridge Pattern is often used. ... The key idea of the Pimpl Idiom is that the implementation of the class is hidden behind a pointer. Here is a recipe for implementing the Pimpl Idiom: ...

 

CppCon 2022 keynote: How C++23 changes the way we write code -- Timur Doumler

Hot off the press from CppCon:

CppCon 2022 keynote: How C++23 changes the way we write code

Timur Doumler

From the announcement:

Timur Doumler on C++23 at his CppCon 2022 keynote in Aurora, Colorado!

This video is in “prerelease” and cannot be found directly on our YouTube channel, instead we are providing a direct link here only! Feel free to share this with colleagues and friends and impress them with your insider access...

The power of ref-qualifiers -- Andreas Fertig

overload171cover.pngNew in this month's Overload magazine:

The power of ref-qualifiers

by Andreas Fertig

From the article:

... What I have illustrated is that there is an issue with range-based for-loops. In (1), we call GetKeeper().items() in the head of the range-based for-loop. By doing this, we create a dangling reference.

ref-qualifiers to the rescue

Now, this brings us to ref-qualifiers. They are often associated with move semantics, but we can use them without move. However, we will soon see why ref-qualifiers make the most sense with move semantics.

A version of Keeper with ref-qualifiers looks like Listing 2...

The gotcha of the C++ temporaries that don’t destruct as eagerly as you thought -- Raymond Chen

RaymondChen_5in-150x150.jpgWorth waiting for:

The gotcha of the C++ temporaries that don’t destruct as eagerly as you thought

by Raymond Chen

From the article:

Forgetting to take a lock when updating variables is a common mistake. One way to make the mistake harder to make is to force the access to occur through some mechanism that proves that you possess the lock. Maybe something like this: ...

Highlighting the student and support tickets for Meeting C++ 2022

Like every year, Meeting C++ is also offering a set of free tickets for students and those that are in need of a little support!

Highlighting the student and support tickets for Meeting C++ 2022

by Jens Weller

From the article

With the schedule published, I'd like to highlight the student and support tickets for Meeting C++ 2022.

For a few years now Meeting C++ has hosted programs to give students, underrepresented folks and those who can't afford a ticket access to the conference. This is supported through the ticket sales and some times sponsorships.