Product News

Top 10 errors in C and C++ projects in 2023

New Year is coming! It means, according to tradition, it's time to recall 10 of the most interesting bugs that PVS-Studio found during 2023.

Top 10 errors in C and C++ projects in 2023

by Alexey Gorshkov

From the article:

In this case, the developers wanted to fill the keyEventList array with zeros. Pay attention to the third parameter — the number of bytes the developers wanted to fill with zeros. In this case, sizeof(keyEventList) evaluates the pointer size instead of the array size. It depends on the target platform, but most often it's 4 or 8 bytes. However, the size of the structure is clearly larger than 4 or 8 bytes.

PVS-Studio 7.28: support for ARM, analysis of Unreal Engine projects without Unity Build, and more

Now you can run the analyzer on the ARM architecture, analyze .NET 8 projects, and check Unreal Engine projects without Unity Build — and there is more to come.

PVS-Studio 7.28: support for ARM, .NET 8, analysis of Unreal Engine projects without Unity Build, and more

by Gleb Aslamov

From the article:

When analyzing Unreal Engine projects with PVS-Studio, we often encounter issues with high memory usage and analysis slowdown. They usually arise when individual translation units are combined into a single file (the Unity Build system). Although the merging of translation units may have a positive impact on the compilation time, the large file size may increase the resource requirements for analysis.

No, C++ static analysis does not have to be painful -- Geoffray Adde

Static analysis as part of your CI pipeline has long been possible -- but tedious, at best, to setup. Sonar are upending that with an innovative new approach.

No, C++ static analysis does not have to be painful

by Geoffray Adde

From the article:

It seems impossible to offer serious C++ static analysis with a great configuration experience. Users must suffer the pain, or not use it at all.
Well, at Sonar we believe in making the impossible, possible and so we've gone ahead and solved this once and for all!

PVS-Studio 7.26: running analysis in VS Code and Qt Creator, integration with DefectDojo, and more

PVS-Studio 7.26 has been released. Now you can run the analysis in plugins for VS Code and Qt Creator; upload the analysis results to DefectDojo, and more. In this note, we'll take a closer look at these and other enhancements.

PVS-Studio 7.26: running analysis in VS Code and Qt Creator, integration with DefectDojo, and more

by Sergey Vasiliev

From the article:

Now the PVS-Studio plugins for Visual Studio Code and Qt Creator support the analysis of C and C++ projects. Moreover, the plugins support mass suppression of analyzer warnings (with the help of suppress files). This mechanism enables you to hide warnings for legacy code and work only with new warnings. In this way, the integration of the analyzer into the project will be much easier.

HPX V1.9.1 released -- STE||AR Group

The STE||AR Group has released V1.9.1 of HPX -- A C++ Standard library for Concurrency and Parallelism.

HPX V1.9.1 Released

We have released HPX 1.9.1 that adds a number of small new features and fixes a handful of problems discovered since the last 1.9.0 release. In particular: we fixed various occasional hanging during startup and shutdown in distributed scenarios. We also added support for zero-copy serialization on the receiving side to the TCP, MPI, and LCI parcelports. Moreover, we have added support for Visual Studio 2019 and GCC using MINGW on Windows, and also support for GCC 13 and Clang 15.0.0. Furthermore, we aligned our header names to their standards counterparts so porting from standard C++ to HPX is now easier. Last but not least, and by adhering to popular demand, we started adding migration guides for people interested in moving their codes away from other, commonplace parallelization frameworks like OpenMP and MPI. We have also continued to improve our documentation, please have a look here.

If you have any questions, comments, or exploits to report you can reach us on IRC or Matrix (#ste||ar on libera.chat) or email us at hpx-users. We depend on your input!

You can download the release from our releases page or check out the v1.9.1 tag using git. A full list of changes can be found in the release notes.

HPX is a general-purpose parallel C++ runtime system for applications of any scale. It implements all of the related facilities as defined by the C++20 Standard. As of this writing, HPX provides the only widely available open-source implementation of the new C++17, C++20, and C++23 parallel algorithms, including a full set of parallel range-based algorithms. Additionally, HPX implements functionalities proposed as part of the ongoing C++ standardization process, such as large parts of the features related parallelism and concurrency as specified by the upcoming C++23 Standard, the C++ Concurrency TS, Parallelism TS V2, data-parallel algorithms, executors, and many more. It also extends the existing C++ Standard APIs to the distributed case (e.g., compute clusters) and for heterogeneous systems (e.g., GPUs).

HPX seamlessly enables a new Asynchronous C++ Standard Programming Model that tends to improve the parallel efficiency of our applications and helps reducing complexities usually associated with parallelism and concurrency.

 

PVS-Studio 7.25: support for latest versions of Qt Creator, Rider, and more

PVS-Studio 7.25 has been released. In this version, we implemented the support of Qt Creator 10 and Rider 2022.2.3 (and higher), updated the libraries used by the analyzer, enhanced the documentation — and that's not all!

PVS-Studio 7.25: support for latest versions of Qt Creator, Rider, and more

by Nikita Lipilin

From the article:

When checking C++ projects that use MSBuild, PVS-Studio did not use the full power of Intel's 12th generation processors (for example, i7-12700, i9-12900). Apparently, the analysis processes were running only on energy-saving cores, while the rest remained idle. In the new version of PVS-Studio, the error has been fixed. Now the analyzer fully loads the processors and works much faster.

HPX V1.9.0 released -- STE||AR Group

The STE||AR Group has released V1.9.0 of HPX -- A C++ Standard library for Concurrency and Parallelism.

HPX V1.9.0 Released

We have released HPX 1.9.0 — a major update to our C++ Standard Library for Concurrency and Parallelism. The HPX parallel algorithms now have been fully adapted to C++23, all existing facilities have been adjusted to conform to this version of the Standard as well. We now can proudly announce full conformance to the C++23 concurrency and parallelism facilities. HPX supports all of the parallel algorithms as specified by C++23. We have been able to significantly improve the performance of some of our algorithms. On top of that we support parallel versions of all range-based algorithms and have added more support for explicit vectorization to our algorithms (using std::experimental::simd). Even more work has been done towards implementing P2300 (std::execution) and keeping the underlying senders/receivers facilities in line with the evolving standardization efforts. We have done a lot of refactoring to improve the consistency of our exposed APIs. Last but not least, we have continued to improve our documentation, please have a look here.

If you have any questions, comments, or exploits to report you can reach us on IRC or Matrix (#ste||ar on libera.chat) or email us at hpx-users. We depend on your input!

You can download the release from our releases page or check out the v1.9.0 tag using git. A full list of changes can be found in the release notes.

HPX is a general-purpose parallel C++ runtime system for applications of any scale. It implements all of the related facilities as defined by the C++20 Standard. As of this writing, HPX provides the only widely available open-source implementation of the new C++17, C++20, and C++23 parallel algorithms, including a full set of parallel range-based algorithms. Additionally, HPX implements functionalities proposed as part of the ongoing C++ standardization process, such as large parts of the features related parallelism and concurrency as specified by the upcoming C++23 Standard, the C++ Concurrency TS, Parallelism TS V2, data-parallel algorithms, executors, and many more. It also extends the existing C++ Standard APIs to the distributed case (e.g., compute clusters) and for heterogeneous systems (e.g., GPUs).

HPX seamlessly enables a new Asynchronous C++ Standard Programming Model that tends to improve the parallel efficiency of our applications and helps reducing complexities usually associated with parallelism and concurrency.

 

C++ Brace Pair Colorization and More in Visual Studio -- Mryam Girmay

Mryam-G1-96x96.jpgVisual Studio has a host of new productivity features, which you can read about in this article.

C++ Brace Pair Colorization and More in Visual Studio

by Mryam Girmay

From the article:

You can now visually distinguish each set of opening and closing braces for your C++ code making it easier to see your code’s scope or find any missing braces. There will be different colors for curly braces, and the paired braces {} will have the same color, which will make it easy to visualize where the braces open and close especially when you have intensely nested codes. The feature is available for C++ today and will be coming to additional languages in subsequent releases.

Debug Linux Console apps in Visual Studio’s Integrated Terminal -- Sinem Akinci

Visual Studio now comes with support for debugging interactive console applications directly from the IDE.

Debug Linux Console apps in Visual Studio’s Integrated Terminal

By Sinem Akinci

From the article:

Now, using the Linux Console embedded in the Integrated Terminal, Visual Studio supports a fully functional terminal-like experience when debugging Linux applications. This new Linux Console emulates an xterm and can support application screen manipulation; for example, writing screen formatting control characters to stdout or using the ncurses library. Additionally, there is support for vt sequences and keyboard shortcuts such as Ctrl+C application interruption.

VS Code C++ Extension January Update: Create Definitions and Declarations -- Alexandra Kemper

You can now create declarations from definitions and vice versa in Visual Studio Code.

VS Code C++ Extension January Update: Create Definitions and Declarations

by Alexandra Kemper

From the article:

Starting with the 1.13.6 version of the C++ Extension in VS Code, we are happy to share a much requested feature: Auto creation of definitions or declarations for functions! You can now quickly create a declaration in a header file for a function you only have a definition for, or vice versa. These generated definitions and declarations already include all function arguments, so no need for constant copying, pasting, and double checking.