Pull to refresh
190.66

C++ *

General-purpose programming language. It has imperative, object-oriented and generic programming features, while also providing facilities for low-level memory manipulation

Show first
Rating limit
Level of difficulty

Checking QEMU using PVS-Studio

Reading time14 min
Views632
image1.png

QEMU is a rather well-known application for emulation. Static analysis can help developers of complex projects such as QEMU catch errors at early stages and generally improve quality and reliability of a project. In this article, we will check the source code of the QEMU application for potential vulnerabilities and errors using the PVS-Studio static analysis tool.
Read more →
Total votes 3: ↑3 and ↓0+3
Comments0

Static code analysis of the PMDK library collection by Intel and errors that are not actual errors

Reading time14 min
Views763
PVS-Studio, PMDK

We were asked to check a collection of open source PMDK libraries for developing and debugging applications with NVRAM support by PVS-Studio. Well, why not? Moreover, this is a small project in C and C++ with a total code base size of about 170 KLOC without comments. Which means, the results review won't take much energy and time. Let's go.
Read more →
Total votes 2: ↑2 and ↓0+2
Comments1

C2x: the future C standard

Reading time8 min
Views16K

image


I strain to make the far-off echo yield
A cue to the events that may come in my day.
(‘Doctor Zhivago’, Boris Pasternak)

I’ll be honest: I don’t write in pure C that often anymore and I haven’t been following the language’s development for a long time. However, two unexpected things happened recently: С won back the title of the most popular programming language according to TIOBE, and the first truly interesting book in years on this language was published. So, I decided to spend a few evenings studying material on C2x, the future version of C.


Here I will share with you what I consider to be its most interesting new features.

Read more →
Total votes 22: ↑21 and ↓1+20
Comments3

PVS-Studio: analyzing pull requests in Azure DevOps using self-hosted agents

Reading time12 min
Views691


Static code analysis is most effective when changing a project, as errors are always more difficult to fix in the future than at an early stage. We continue expanding the options for using PVS-Studio in continuous development systems. This time, we'll show you how to configure pull request analysis using self-hosted agents in Microsoft Azure DevOps, using the example of the Minetest game.
Read more →
Total votes 3: ↑3 and ↓0+3
Comments0

PVS-Studio and Continuous Integration: TeamCity. Analysis of the Open RollerCoaster Tycoon 2 project

Reading time8 min
Views631

One of the most relevant scenarios for using the PVS-Studio analyzer is its integration into CI systems. Even though a project analysis by PVS-Studio can already be embedded with just a few commands into almost any continuous integration system, we continue to make this process even more convenient. PVS-Studio now supports converting the analyzer output to the TeamCity format-TeamCity Inspections Type. Let's see how it works.
Read more →
Total votes 3: ↑1 and ↓2-1
Comments0

The Code of the Command & Conquer Game: Bugs from the 90's. Volume two

Reading time13 min
Views3.4K
image1.png

The American company Electronic Arts Inc (EA) has opened the source code of the games Command & Conquer: Tiberian Dawn and Command & Conquer: Red Alert publicly available. Several dozen errors were detected in the source code using the PVS-Studio analyzer, so, please, welcome the continuation of found defects review.
Read more →
Total votes 4: ↑4 and ↓0+4
Comments1

PVS-Studio is now in Compiler Explorer

Reading time4 min
Views1K
image1.png

Not so long ago, a landmark event has happened: PVS-Studio appeared in Compiler Explorer! Now you can quickly and easily analyze the code for errors right on the godbolt.org site (Compiler Explorer). This feature opens up a large number of new possibilities – from quenching curiosity about the analyzer's abilities to being able to quickly share check results with a friend. This article will cover the topic on how to use these features. Caution – large GIFs!
Read more →
Total votes 1: ↑1 and ↓0+1
Comments0

The Code of the Command & Conquer Game: Bugs From the 90's. Volume one

Reading time13 min
Views2K
image1.png

The American company Electronic Arts Inc (EA) has made the source code of the games Command & Conquer: Tibetan Dawn and Command & Conquer: Red Alert publicly available. This code should help the game community to develop mods and maps, create custom units, and customize the gameplay logic. We all now have a unique opportunity to plunge into the history of development, which is very different from the modern one. Back then, there was no StackOverflow site, convenient code editors, or powerful compilers. Moreover, at that time, there were no static analyzers, and the first thing the community will face is hundreds of errors in the code. This is what the PVS-Studio team will help you with by pointing out the erroneous places.
Read more →
Total votes 2: ↑2 and ↓0+2
Comments1

How to climb a tree

Reading time20 min
Views1.1K

Picture 2

Rather, how to get down from it. But first things first. This article stands out a bit of the usual format of articles from PVS-Studio. We often write about checking other projects, but almost never lift the veil on our inner workings. It's time to rectify this omission and talk about how the analyzer is built from the inside. More precisely, about the most important of its parts — the syntax tree. The article will focus on the part of PVS-Studio that relates to the C and C++ languages.
Read more →
Rating0
Comments0

Diamond inheritance problem is not a problem, that's a tricky feature

Reading time7 min
Views4.1K

General


Before discussing the topic I’d like to start with a general suggestion not to use multiple inheritance and especially diamond unless you are strongly forced to. You may use e.g. composition or aggregation instead.


Well, “Diamond inheritance problem” is some kind of steady expression which formed many years ago. You can easily find a lot of articles suggesting usage of “virtual public” to avoid the ambiguity and so on. For instance, https://en.wikipedia.org/wiki/Multiple_inheritance


image


 That is not wrong as for the problem stated but anyway it is quite one-side statement.
 Below you can find:


  • difference in memory allocation and initialization order between public and public virtual inheritance (examples 1, 2),
  • examples of practical usage of both public and public virtual inheritance (examples 3, 4).
Read more →
Total votes 4: ↑4 and ↓0+4
Comments0

A Second Check of Newton Game Dynamics with PVS-Studio

Reading time10 min
Views604

Рисунок 1

Some time ago, somewhere on the Internet, I stumbled upon a physics engine called Newton Game Dynamics. Knowing that engine projects are usually big and complex, I decided to check its code with PVS-Studio for any interesting defects. I was especially enthusiastic about this one because my co-worker Andrey Karpov already checked it in 2014 and a second check would be a good opportunity to demonstrate our analyzer's evolution over the past six years. As of this writing, the latest version of Newton Game Dynamics is dated February 27, 2020, which means it has been actively developing for the past six years too. So, hopefully, this article will be interesting not only to us but to the engine's developers as well – and for them it's a chance to fix some bugs and improve their code.
Read more →
Rating0
Comments0

Checking the GCC 10 Compiler with PVS-Studio

Reading time9 min
Views1.6K

PVS-Studo vs GCC 10

The GCC compiler is written with copious use of macros. Another check of the GCC code using PVS-Studio once again confirms the opinion of our team that macros are evil in the flesh. Not only does the static analyzer struggle with reviewing such code, but also a developer. GCC developers are certainly used to the project and are well versed in it. Nonetheless, it is very difficult to understand something on the third hand. Actually, due to macros, it was not possible to fully perform code checking. However, the PVS-Studio analyzer, as always, showed that it can find errors even in compilers.
Read more →
Total votes 4: ↑3 and ↓1+2
Comments1

Starting My Collection of Bugs Found in Copy Functions

Reading time4 min
Views752

memcpy

I've already noticed a few times before that programmers seem to tend to make mistakes in simple copy functions. Writing a profound article on this topic is going to take quite a while since I'll have to do some thorough research and sample collecting, but for now I'd like to share a couple of examples I stumbled upon recently.
Read more →
Rating0
Comments0

How Deep the Rabbit Hole Goes, or C++ Job Interviews at PVS-Studio

Reading time4 min
Views1.7K

Job Interviews at PVS-Studio

Authors: Andrey Karpov, khandeliants Phillip Khandeliants.
Here's an interesting story about how one of the questions we ask at job interviews turned out to reach even deeper than intended by its author. You've always got to watch your step with C++ and C++ compilers – there's never a risk of getting bored.
Read more →
Rating0
Comments0

Checking the Code of Zephyr Operating System

Reading time13 min
Views1.9K

PVS-Studio and Zephyr

Some time ago we announced PVS-Studio's new feature that enabled it to integrate into PlatformIO. Naturally, our team kept in touch with the PlatformIO team while working on that feature, and they suggested that we check the real-time operating system Zephyr to see if we could find any interesting bugs in its code. We thought it was a good idea, and so here's this article about the check results.
Read more →
Total votes 4: ↑3 and ↓1+2
Comments0

OpenToonz: inside and out

Reading time10 min
Views643
Picture 1

Almost four years have passed since the PVS-Studio team checked the OpenToonz source code. This project is a very powerful tool for creating two-dimensional animation. Since the last check, with its help, such animated works as Mary and the Witch Flower, Batman-Ninja, Promare and others were created. As large studios continue using Toonz, why not check the quality of the source code again?
Read more →
Total votes 3: ↑3 and ↓0+3
Comments0

Analyze your builds programmatically with the C++ Build Insights SDK

Reading time4 min
Views1.8K
We’re happy to announce today the release of the C++ Build Insights SDK, a framework that gives you access to MSVC build time information via C and C++ APIs. To accompany this release, we are making vcperf open source on GitHub. Because vcperf itself is built with the SDK, you can use it as a reference when developing your own tools. We’re excited to see what sort of applications you’ll be building with the SDK, and we’re looking forward to receiving your feedback!

Read more →
Total votes 2: ↑2 and ↓0+2
Comments0

Authors' contribution