Pull to refresh
175.44

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
Period
Level of difficulty

One Day from PVS-Studio User Support

Reading time2 min
Views818
Picture 2

We welcome any chatting on code quality. Our clients, students, and other users from all corners of the Internet write to us. Regardless of the country, time zone or language. Well, speaking language, not programming. Among programming languages, we are so far interested in a limited set. Right now, it's C, C++, C# and Java. There are many benefits from communication. We implement some users' suggestions immediately, because they are really useful. Often we just lend a hand with someone's project by explaining analyzer warnings, which end up being errors. This note is about such case.
Read more →
Total votes 28: ↑25 and ↓3+22
Comments2

How to set up PVS-Studio in Travis CI using the example of PSP game console emulator

Reading time11 min
Views675

PPSSPP

Travis CI is a distributed web service for building and testing software that uses GitHub as a source code hosting service. In addition to the above scripts, you can add your own, thanks to the extensive configuration options. In this article we will set up Travis CI for working with PVS-Studio by the example of PPSSPP code.
Read more →
Total votes 26: ↑24 and ↓2+22
Comments0

How to quickly check out interesting warnings given by the PVS-Studio analyzer for C and C++ code?

Reading time5 min
Views979

Once in a while, programmers who start getting acquainted with the PVS-Studio code analyzer ask me: «Is there a list of warnings that accurately indicate errors?» There is no such list because uninteresting (false) warnings in one project are very important and useful in another one. However, one can definitely start digging into the analyzer from the most exciting warnings. Let's take a closer look at this topic.
Read more →
Total votes 22: ↑22 and ↓0+22
Comments0

CMake: the Case when the Project's Quality is Unforgivable

Reading time11 min
Views2K

Picture 1

CMake is a cross-platform system for automating project builds. This system is much older than the PVS-Studio static code analyzer, but no one has tried to apply the analyzer on its code and review the errors. As it turned out, there are a lot of them. The CMake audience is huge. New projects start on it and old ones are ported. I shudder to think of how many developers could have had any given error.
Read more →
Total votes 25: ↑23 and ↓2+21
Comments0

Getting Started with the PVS-Studio Static Analyzer for C++ Development under Linux

Reading time4 min
Views2K
PVS-Studio supports analyzing projects developed in C, C++, C#, and Java. You can use the analyzer under Windows, Linux, and macOS. This small article will tell you the basics of analyzing C and C++ code in Linux environment.

Installation


There are different ways to install PVS-Studio under Linux, depending on your distro type. The most convenient and preferred method is to use the repository, since it allows auto-updating the analyzer upon releasing new versions. Another option is to use the installation package, which you can get here.
Read more →
Total votes 27: ↑24 and ↓3+21
Comments0

C++ Binary Compatibility and Pain-Free Upgrades to Visual Studio 2019

Reading time4 min
Views3.6K

Visual Studio 2019 pushes the boundaries of individual and team productivity. We hope that you will find these new capabilities compelling and start your upgrade to Visual Studio 2019 soon.


As you are considering this upgrade, rest assured that Visual Studio 2019 makes it distinctively easy to move your codebase from previous versions of Visual Studio. This post captures the reasons why your upgrade to Visual Studio 2019 will be pain-free.


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

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

Almost Perfect Libraries by Electronic Arts

Reading time4 min
Views5.7K
Our attention was recently attracted by the Electronic Arts repository on GitHub. It's tiny, and of the twenty-three projects available there, only a few C++ libraries seemed interesting: EASTL, EAStdC, EABase, EAThread, EATest, EAMain, and EAAssert. The projects themselves are tiny too (about 10 files each), so bugs were found only in the «largest» project of 20 files :D But we did find them, and they do look interesting! As I was writing this post, we were also having a lively discussion of EA games and the company's policy :D

Picture 1

Read more →
Total votes 24: ↑22 and ↓2+20
Comments0

Errors that static code analysis does not find because it is not used

Reading time5 min
Views1.8K
Readers of our articles occasionally note that the PVS-Studio static code analyzer detects a large number of errors that are insignificant and don't affect the application. It is really so. For the most part, important bugs have already been fixed due to manual testing, user feedback, and other expensive methods. At the same time, many of these errors could have been found at the code writing stage and corrected with minimal loss of time, reputation and money. This article will provide several examples of real errors, which could have been immediately fixed, if project authors had used static code analysis.

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

How to speed up LZ4 decompression in ClickHouse?

Reading time23 min
Views15K
When you run queries in ClickHouse, you might notice that the profiler often shows the LZ_decompress_fast function near the top. What is going on? This question had us wondering how to choose the best compression algorithm.

ClickHouse stores data in compressed form. When running queries, ClickHouse tries to do as little as possible, in order to conserve CPU resources. In many cases, all the potentially time-consuming computations are already well optimized, plus the user wrote a well thought-out query. Then all that's left to do is to perform decompression.



So why does LZ4 decompression becomes a bottleneck? LZ4 seems like an extremely light algorithm: the data decompression rate is usually from 1 to 3 GB/s per processor core, depending on the data. This is much faster than the typical disk subsystem. Moreover, we use all available CPU cores, and decompression scales linearly across all physical cores.
Read more →
Total votes 23: ↑21 and ↓2+19
Comments0

False Positives in PVS-Studio: How Deep the Rabbit Hole Goes

Reading time6 min
Views793
Единорог PVS-Studio и GetNamedSecurityInfo

Our team provides quick and effective customer support. User requests are handled solely by programmers since our clients are programmers themselves and they often ask tricky questions. Today I'm going to tell you about a recent request concerning one false positive that even forced me to carry out a small investigation to solve the problem.
Read more →
Total votes 21: ↑20 and ↓1+19
Comments0

PVS-Studio for Visual Studio

Reading time10 min
Views1.1K


Many of our articles are focused on anything, but not the PVS-Studio tool itself. Whereas we do a lot to make its usage convenient for developers. Nevertheless, our efforts are often concealed behind the scenes. I decided to remedy this situation and tell you about the PVS-Studio plugin for Visual Studio. If you use Visual Studio, this article is for you.
Read more →
Total votes 18: ↑18 and ↓0+18
Comments0

Currying and partial application in C++14

Reading time10 min
Views7.3K

In this article I'm going to tell you about one of the currying options and partial application of the functions in C++ which is my personal favourite. I'm also going to show my own pilot implementation of this thing and explain the point of currying without complex mathematical formula, making it really simple for you. We'll also see what's under the hood of kari.hpp library which we'll be using for currying functions. Anyway, there are lots of fascinating stuff inside, so welcome!

Читать дальше →
Total votes 18: ↑18 and ↓0+18
Comments0

PVS-Studio 7.04

Reading time8 min
Views877
Picture 4

Summer is not only a holiday season, but also time of fruitful work. Sunny days are so inspiring that there's enough energy both for late walks and large code commits. The second summer PVS-Studio 7.04 release turned out to be quite large, so we suggest for your attention this press release, in which we'll tell you about everything.
Read more →
Total votes 21: ↑19 and ↓2+17
Comments1

How to shoot yourself in the foot in C and C++. Haiku OS Cookbook

Reading time20 min
Views2.9K
The story of how the PVS-Studio static analyzer and the Haiku OS code met goes back to the year 2015. It was an exciting experiment and useful experience for teams of both projects. Why the experiment? At that moment, we didn't have the analyzer for Linux and we wouldn't have it for another year and a half. Anyway, efforts of enthusiasts from our team have been rewarded: we got acquainted with Haiku developers and increased the code quality, widened our error base with rare bugs made by developers and refined the analyzer. Now you can check the Haiku code for errors easily and quickly.
Picture 1

Read more →
Total votes 18: ↑17 and ↓1+16
Comments1

Following in the Footsteps of Calculators: Qalculate

Reading time7 min
Views1.4K

Previously we did code reviews of large mathematical packages, for example, Scilab and Octave, whereby calculators remained aloof as small utilities, in which it is difficult to make errors due to their small codebase. We were wrong that we haven't paid attention to them. The case with posting the source code of the Windows calculator showed that actually everyone was interested in discussing types of errors hiding in it. Moreover, the number of errors there was more than enough to write an article about that. My colleagues and I, we decided to explore the code of a number of popular calculators, and it turned out that the code of the Windows calculator was not that bad (spoiler).
Read more →
Total votes 22: ↑19 and ↓3+16
Comments3

The dangers of using multi-character constants

Reading time2 min
Views1.3K

Picture 1

During code analysis, PVS-Studio analyzes the data flow and operates variable values. Values are taken from constants or derived from conditional expressions. We call them virtual values. Recently, we have refined them in order to work with multi-character constants and this has become the reason to create a new diagnostic rule.

Introduction


Multi-character-literals are implementation-defined, so different compilers can encode them in different ways. For example, GCC and Clang set a value, based on the order of the symbols in the literal, while MSVC moves them depending on the symbol's type (regular or escape).
Read more →
Total votes 16: ↑15 and ↓1+14
Comments0

Another way to write cross-platform apps: Neutralinojs internals and comparison with Electron and NW.js

Reading time5 min
Views8.8K


I am Shalitha Suranga from Sri Lanka. I started Neutralinojs project with other two members as our research project at university.


Cross-platform application development is extremely useful among software development organizations because a large end-user audience can be targeted. Earlier there were several approaches, such as writing multiple codebases per each platform, writing a single codebase using conditionals for platform selection, or using a programming language which has a cross-platform virtual machine at run-time. There were drawbacks of each like complexity of design, limited low-level accessibility and slow learning rate. Cross-platform application development with web technologies came [1] after. Electron and NW.js are most popular frameworks which allow developers to make cross-platform applications using Javascript. Basically, these popular frameworks combine embedded chromium browser and node run-time [2], [3].


These frameworks are being used to create numerous cross-platform applications. Whereas the community pointed out several unseen drawbacks of these frameworks. Large bundled application size, high memory consumption and long development workflow are the key things which were criticized through internet forums and websites [4], [5], [6], [7], [8]. Table 1.1 shows the advantages and disadvantages of Electron/NW.js.


Table 1.1: Advantages and Disadvantages of Electron/NW,js


Advantages of Electron and NW.js Disadvantages of Electron and NW.js
Development is very easy since Javascript is used Application bundle is considered as bloatware (High disk space usage)
Access native functions via node runtimeSingle codebase for all supported platforms Linux, Windows and macOS High memory consumption and slowness
Many Node modules need to be installed
Read more →
Total votes 20: ↑17 and ↓3+14
Comments3
Change theme settings

Authors' contribution