Archives

Posts from Andrey Karpov RSS

Andrey Karpov

Andrey Karpov is candidate of science (philosophy doctor) in the field of mathematical modeling, numerical methods and complexes of the programs. Andrey Karpov defended his thesis in the Institute of Mathematical Modelling under Russian Academy of Sciences. The theme of his thesis is "Data Processing in Parallel Computer Complexes". Andrey Karpov is expert in C++ language and in methodology of source program code static analysis. In 2008 Andrey Karpov and Evgeniy Ryzhkov founded Program Verification Systems company. The main activity of the company is development and selling of developers' tools in the field of code analysis. Andrey Karpov is the author of dozens of published works and registration certificates of programs. The main themes of these works are: data visualization in gas dynamics, development of 64-bit and parallel program systems, source code analysis technology. He takes active part in conferences devoted to these themes. E-Mail: karpov@viva64(dot)com

PVS-Studio: analyzing Doom 3 code

By Andrey Karpov (54 posts) on February 8, 2012 at 10:45 am
Comments (3)

The id Software company possesses a PVS-Studio license. However, we decided to test the source codes of Doom 3 that have been recently laid out on the Internet. The result is the following: we managed to find just few errors, but still they are there. I think it can be explained by the following fact. [...]

Continued ›

Category: Game Development
Tags: , , ,

Myths about static analysis. The third myth - dynamic analysis is better than static analysis.

By Andrey Karpov (54 posts) on February 8, 2012 at 10:45 am
Comments (0)

While communicating with people on forums, I noticed there are a few lasting misconceptions concerning the static analysis methodology. I decided to write a series of brief articles where I want to show you the real state of things. The third myth is: "Dynamic analysis performed by tools like valgrind for C/C++ is much better [...]

Continued ›

Category: Parallel Programming
Tags: , , ,

Myths about static analysis. The fourth myth - programmers want to add their own rules into a static analyzer.

By Andrey Karpov (54 posts) on February 8, 2012 at 10:45 am
Comments (0)

While communicating with people on forums, I noticed there are a few lasting misconceptions concerning the static analysis methodology. I decided to write a series of brief articles where I want to show you the real state of things. The fourth myth is: "A static analyzer must enable users to add user-made rules. Programmers want [...]

Continued ›

Category: Parallel Programming
Tags: ,

Myths about static analysis. The fifth myth - a small test program is enough to evaluate a tool.

By Andrey Karpov (54 posts) on February 8, 2012 at 10:44 am
Comments (0)

While communicating with people on forums, I noticed there are a few lasting misconceptions concerning the static analysis methodology. I decided to write a series of brief articles where I want to show you the real state of things. The fifth myth: "You can easily evaluate capabilities of a static analyzer on a small test [...]

Continued ›

Category: Parallel Programming
Tags:

The way to becoming an Intel Black Belt Software Developer

By Andrey Karpov (54 posts) on February 8, 2012 at 10:44 am
Comments (4)

The Intel company holds a lot of specialist training programs, carries out programming contests, invites people to meetings and free conferences. Unfortunately, we often miss such events, and one gets upset on knowing that he/she did not participate in an already finished event. By the way, participating in Intel contests often ends with a participant [...]

Continued ›

Category: Site News & Announcements
Tags: , , ,

Myths about static analysis. The second myth - expert developers do not make silly mistakes.

By Andrey Karpov (54 posts) on November 16, 2011 at 11:48 am
Comments (0)

While communicating with people on forums, I noticed there are a few lasting misconceptions concerning the static analysis methodology. I decided to write a series of brief articles where I want to show you the real state of things. The second myth is: "Expert developers do not make silly mistakes that are mostly caught by [...]

Continued ›

Category: Parallel Programming
Tags: , ,

Myths about static analysis. The first myth - a static analyzer is a single-use product

By Andrey Karpov (54 posts) on November 16, 2011 at 11:43 am
Comments (0)

While communicating with people on forums, I noticed there are a few lasting misconceptions concerning the static analysis methodology. I decided to write a series of brief articles where I want to show you the real state of things. The first myth is: "A static analyzer is a single-use product". This is how this statement [...]

Continued ›

Category: Parallel Programming
Tags: , , ,

PVS-Studio: analyzing ReactOS's code

By Andrey Karpov (54 posts) on September 11, 2011 at 8:46 pm
Comments (0)

Having checked ReactOS's code I managed to fulfill three of my wishes at once. Firstly, I had wanted for a long time to write an article on a common project. It's not interesting to check the source code of projects like Chromium: its quality is too high and a lot of resources are spent to [...]

Continued ›

Category: Parallel Programming
Tags: , , , , ,

PVS-Studio vs Clang

By Andrey Karpov (54 posts) on August 8, 2011 at 8:22 am
Comments (3)

By chance, we have checked the Clang project. I think some developers will be curious about the results. Presently PVS-Studio uses the external preprocessor of Microsoft Visual C++, which is a large disadvantage. Visual C++'s preprocessor is extremely slow and has some errors we cannot fix. Yes, do not be surprised that the preprocessor works [...]

Continued ›

Category: Open Source, Parallel Programming
Tags: , , , , ,

How we have Solved an Engineering task for Several Years in PVS-Studio

By Andrey Karpov (54 posts) on August 5, 2011 at 12:01 pm
Comments (0)

At first I wanted to title this post "How PVS-Studio enables cheap integration of static code analysis into the development process" but I decided not to do it because of the ambiguous interpretation of the word "cheap". So I will tell you about one engineering problem we had to solve constantly to enable people to [...]

Continued ›

Category: Parallel Programming
Tags: , , ,

Leo Tolstoy and Static Code Analysis

By Andrey Karpov (54 posts) on August 5, 2011 at 12:00 pm
Comments (1)

This time we checked Apache HTTP Server with PVS-Studio. As we had expected, we found errors there. The errors are few. We expected this either. Other developers come across this situation too while testing PVS-Studio on their projects. Unfortunately, the first conclusion you would like to draw on seeing just a few errors is that [...]

Continued ›

Category: Parallel Programming
Tags: , , , , , ,

All about 64-bit programming in one place

By Andrey Karpov (54 posts) on July 7, 2011 at 7:39 am
Comments (7)

In this post I've collected a lot of links on the topic of 64-bit C/C++ software development. These include my articles and articles by my colleagues in the sphere of developing safe and efficient 64-bit code; FAQ's and a training course. There are also many reviews of third-party articles on 64-bit software development. Enjoy yourself [...]

Continued ›

Category: Parallel Programming
Tags: , , , , , ,

Everything about C++ source code static analysis

By Andrey Karpov (54 posts) on July 7, 2011 at 7:37 am
Comments (1)

I decided to collect all the resources on static code analysis in one place. Surfing by the links you will learn what static code analysis is, what for it is used and what static analysis tools exist. You will read interesting articles and if you wish, you may join a group discussing the topic under [...]

Continued ›

Category: Parallel Programming
Tags: , ,

PVS-Studio has learned to watch over your programming

By Andrey Karpov (54 posts) on June 28, 2011 at 11:10 am
Comments (0)

PVS-Studio now has an operation mode that will help you to find errors and misprints as soon as possible. The analyzer launches right after the files have been compiled and "blushes with shame" for your code if something goes wrong. The feature is currently available only for Visual Studio 2010 users. I wrote many times [...]

Continued ›

Category: Software Tools
Tags: , , , , , , ,

Cases when a static code analyzer may help you

By Andrey Karpov (54 posts) on May 9, 2011 at 8:06 pm
Comments (0)

Static code analysis is used most often for controlling the quality of a project being developed. But static code analysis can be also used to solve some more peculiar tasks. I would like to describe some of these in this post.

Continued ›

Category: Parallel Programming
Tags: , , ,

Is it reasonable to use the prefix increment operator ++it instead of postfix operator it++ for iterators?

By Andrey Karpov (54 posts) on May 4, 2011 at 7:26 am
Comments (2)

I decided to find out if there is practical sense in writing ++iterator instead of iterator++ when handling iterators. My interest in this question arouse far not from my love to art but from practical reasons. We have intended for a long time to develop PVS-Studio not only in the direction of error search but in the direction of prompting tips on code optimization. A message telling you that you'd better write ++iterator is quite suitable in the scope of optimization.

Continued ›

Category: Parallel Programming
Tags: , ,

Difficulties of comparing code analyzers, or don't forget about usability

By Andrey Karpov (54 posts) on April 22, 2011 at 4:09 pm
Comments (0)

Abstract Users' desire to compare different code analyzers is natural and understandable. However, it's not so easy to fulfill this desire as it may seem at first sight. The point is that you don't know what particular factors must be compared. Introduction If we eliminate such quite ridiculous ideas like "we should compare the number [...]

Continued ›

Category: Software Tools

"What is it?" – a new option of PVS-Studio code analyzer

By Andrey Karpov (54 posts) on April 22, 2011 at 3:56 pm
Comments (0)

While developing, maintaining and selling the PVS-Studio analyzer of C/C++ code, we find it very interesting to communicate with potential users of our software product.

Continued ›

Category: Parallel Programming
Tags:

Knowledge base of issues related to 64-bit and parallel software development

By Andrey Karpov (54 posts) on April 8, 2011 at 11:00 am
Comments (0)

We created a new section called knowledge base". Here we lay out materials concerning particular questions developers ask when creating 64-bit and parallel software.

Continued ›

Category: Parallel Programming, Software Tools
Tags: , ,

Searching for explicit conversion of a pointer to a 32-bit type

By Andrey Karpov (54 posts) on December 10, 2010 at 9:09 am
Comments (0)

In Win64, the pointer's size is 64-bit while the int type's size is still 32 bits. Explicit type conversion truncates the pointer's value, which will cause an error in case the pointer refers to an object situated outside the first 4 low-order Gbytes.

Continued ›

Category: Parallel Programming
Tags: , , ,

64-bit programs and floating-point calculations

By Andrey Karpov (54 posts) on December 10, 2010 at 9:08 am
Comments (0)

A developer who is porting his Windows-application to the 64-bit platform sent a letter to our support service with a question about using floating-point calculations.

Continued ›

Category: Parallel Programming
Tags: , ,

Big Brother helps you

By Andrey Karpov (54 posts) on December 10, 2010 at 9:07 am
Comments (0)

I was convinced one more time that programmers write programs absolutely carelessly, so that their programs work not because of their skill but due to chance and care of Microsoft or Intel compiler developers. Right it is they who really care and put crutches under our lop-sided programs when necessary.

Continued ›

Category: Parallel Programming, Software Tools
Tags: , , ,

Static analysis and regular expressions

By Andrey Karpov (54 posts) on December 10, 2010 at 9:01 am
Comments (0)

This question arises not for the first time, so I decided to write an article to explain why it is a very bad idea to try to use regular expressions for C/C++ code analysis.

Continued ›

Category: Parallel Programming
Tags: , , , ,

The reasons why 64-bit programs require more stack memory

By Andrey Karpov (54 posts) on July 1, 2010 at 3:22 pm
Comments (3)

In forums, people often say that 64-bit versions of programs consume a larger amount of memory and stack.

Continued ›

Category: Software Tools
Tags: , , , ,

In what way can C++0x standard help you eliminate 64-bit errors

By Andrey Karpov (54 posts) on March 8, 2010 at 12:17 pm
Comments (1)

Programmers see in C++0x standard an opportunity to use lambda-functions and other entities I do not quite understand :). But personally I see convenient means in it that allow us to get rid of many 64-bit errors.

Continued ›

Category: Parallel Programming, Software Tools
Tags: , , ,

Verification and validation

By Andrey Karpov (54 posts) on February 20, 2010 at 11:42 am
Comments (1)

The terms verification and validation are related to software quality checking. We use these terms in our articles and reports. Very often we have heard various comments and debates concerning the question if static analysis of program source code should be referred to verification and validation and in what way these notions differ. On a [...]

Continued ›

Category: Software Tools
Tags:

Optimization in the world of 64-bit errors

By Andrey Karpov (54 posts) on February 18, 2010 at 11:41 am
Comments (0)

In the previous blog-post I promised to tell you why it is difficult to demonstrate 64-bit errors by simple examples. We spoke about operator[] and I told that in simple cases even incorrect code might work. Here is such an example: class MyArray { public: char *m_p; size_t m_n; MyArray(const size_t n) { m_n = [...]

Continued ›

Category: Software Tools
Tags: , ,

Search of 64-bit errors in array implementation

By Andrey Karpov (54 posts) on February 16, 2010 at 11:40 am
Comments (0)

In PVS-Studio 3.43, we revised the way how Viva64 analyzer detects errors in the classes serving as containers (arrays).

Continued ›

Category: Software Tools
Tags: , , , ,

Peculiarities of virtual functions

By Andrey Karpov (54 posts) on February 16, 2010 at 11:39 am
Comments (0)

I decided to describe one thing related to virtual functions because I am afraid I can forget it and return to this question once again later. :)

Continued ›

Category: Software Tools
Tags: , , , ,

Many cores is good but a fast hard disk is good too

By Andrey Karpov (54 posts) on February 14, 2010 at 11:37 am
Comments (0)

Once, due to some reason, the tests were moved from SATA RAID to IDE. After that, it took us a long time to understand why the tests now executed four hours instead of two!

Continued ›

Category: Software Tools
Tags: ,

The role of "Fibonacci numbers" in the history of parallel programming

By Andrey Karpov (54 posts) on February 12, 2010 at 11:32 am
Comments (1)

I have been known no rest because of these Fibonacci numbers since recently! Whatever materials on parallel programming I encounter, everywhere meet I these numbers! It looks like all parallel programming is related only to the issue of calculating Fibonacci numbers.

Continued ›

Category: Parallel Programming
Tags:

One of the Answers to the Question "Who Needs All that Parallelism at All?"

By Andrey Karpov (54 posts) on February 10, 2010 at 11:31 am
Comments (0)

One can often find discussions on the net that multicore processors, as well as parallelism, are needless, and all this is tricks of one (two or three) companies, which need to sell new processors. I will not appeal to everyone "loving" parallelism, I will just tell about parallel applications helping software developers.

Continued ›

Category: Software Tools
Tags:

Issues in real programs - what errors are not there in the world...

By Andrey Karpov (54 posts) on December 28, 2009 at 8:00 am
Comments (0)

When testing the analyzer PVS-Studio on one of the projects we found an interesting error. This error does not refer to the topic of 64-bits although its consequences are diagnosed as 64-bit problems. But this error attracts attention due to its unusual character and we decided to describe it in the blog.

Continued ›

Category: Software Tools
Tags: ,

Cold Tachyon

By Andrey Karpov (54 posts) on December 25, 2009 at 8:00 am
Comments (1)

We have been wishing for a long time to give a new example of using VivaMP analyzer included into PVS-Studio to detect errors in parallel code. It turned out that this alternative approach to code analysis can be well demonstrated by the example of Tachyon.

Continued ›

Category: Parallel Programming
Tags: , , ,

Why A + B != A - (-B)

By Andrey Karpov (54 posts) on December 23, 2009 at 8:00 am
Comments (0)

But when we compile the 64-bit code, the expressions "A + B" and "A - (-B)" mean absolutely different things. The subexpression "-B" has an unsigned type and equals 0xFFFFFFFFu. And it is this value 0xFFFFFFFFu that is subtracted from the pointer.

Continued ›

Category: Software Tools
Tags: , ,

64-bit code issues in real programs: pointer type change

By Andrey Karpov (54 posts) on December 21, 2009 at 10:41 am
Comments (1)

Explicit type conversions often mask errors related to a change of a pointer type. One of such errors is casting of a pointer to 32-bit objects into a pointer to 64-bit ones.

Continued ›

Category: Software Tools

A nice 64-bit error in C

By Andrey Karpov (54 posts) on December 2, 2009 at 5:07 pm
Comments (4)

In C language, you may use functions without defining them. Of course, this ability is very dangerous. Let us have a look at an interesting example of a 64-bit error related to it.

Continued ›

Category: Parallel Programming, Software Tools
Tags: , , ,

Be careful when working with atomic directive

By Andrey Karpov (54 posts) on November 23, 2009 at 4:06 pm
Comments (0)

I would like to tell you about an error that a person not familiar with OpenMP technology too well can easily make. The error is related to a wrong supposition about how atomic directive works.

Continued ›

Category: Parallel Programming
Tags: , , ,

Issues of 64-bit code in real programs: virtual functions

By Andrey Karpov (54 posts) on November 23, 2009 at 4:03 pm
Comments (0)

So, if you download the demo-version of this library, install it and search the word "WinHelp" through .h-files… you will see that everywhere this function is supposedly overlapped, DWORD parameter is used instead of DWORD_PTR. And this means that Help system in these classes will behave incorrectly on a 64-bit system.

Continued ›

Category: Software Tools
Tags: , , , , ,

Processing of exceptions inside parallel sections

By Andrey Karpov (54 posts) on November 17, 2009 at 11:16 am
Comments (0)

That is using of a "nothrow"-variant of new operator which returns NULL in case of failure and allows you to write a simpler OpenMP code.

Continued ›

Category: Parallel Programming
Tags: ,

Magic constants and malloc() function

By Andrey Karpov (54 posts) on November 17, 2009 at 11:15 am
Comments (0)

Once again I would like to discuss the issue of using magic constants in code. We can eternally repeat that one should use sizeof() operator for correct calculation of the size of memory being allocated. But both this knowledge and correct writing of a new code will not help you detect an error already existing in the maze of the old code in large projects.

Continued ›

Category: Parallel Programming, Software Tools
Tags: , , ,

Presentation of information on the site viva64.com

By Andrey Karpov (54 posts) on November 11, 2009 at 8:52 am
Comments (0)

I am addressing the blog’s readers for a word of advice on how to lay out information on our site. With time, besides PVS-Studio code analysis program product we are developing and selling, www.viva64.com site has included articles and a blog for programmers, presentations/demonstrations/booklets about PVS-Studio code analyzer and solid information traditional for corporate sites. [...]

Continued ›

Category: Uncategorized
Tags: ,

Are "64-bit errors" real?

By Andrey Karpov (54 posts) on November 11, 2009 at 8:51 am
Comments (0)

I often hear in various interpretations the phrase: "The given examples show not the code incorrect from the viewpoint of porting to x64 systems, but the code incorrect in itself". I would like to discuss and theorize a bit on this point in the blog. Please, take this note with a bit of humor.

Continued ›

Category: Software Tools
Tags: , ,

Problems of 64-bit code in real programs: magic constants

By Andrey Karpov (54 posts) on November 10, 2009 at 4:37 pm
Comments (0)

The error described deserves attention because of its simplicity or even ingenuousness. It has been recommended in all the books for many years not to use magic constants in code. Everyone knows about it and mentions it in coding standards. But in practice magic numbers appear in various code sections again and again.

Continued ›

Category: Software Tools
Tags: , ,

Testing of Linux-applications with the help of PVS-Studio in Windows

By Andrey Karpov (54 posts) on November 10, 2009 at 4:37 pm
Comments (1)

By default, Viva64 code analyzer (and now PVS-Studio) is oriented on LLP64 data model being intended for operation in Windows environment. Roughly speaking, it means that it searches incorrect shared use of size_t-types and int-types. To test the code on correctness in 64-bit Linux-environment you need to search incorrect shared use of long-types and int-types as well.

Continued ›

Category: Software Tools
Tags: , , , , , ,

PVS-Studio and testing Loki

By Andrey Karpov (54 posts) on November 9, 2009 at 8:40 am
Comments (3)

In PVS-Studio 3.10, support parsing of complex constructions based on templates will be improved what will allow you to efficiently search errors even in the code of those programs which use complex template libraries such as Loki.

Continued ›

Category: Software Tools
Tags: , , , , ,

OpenMP 3.0 and iterators

By Andrey Karpov (54 posts) on November 9, 2009 at 8:39 am
Comments (3)

There is pleasant news for the developers who want to use iterators and OpenMP together in their programs.

Continued ›

Category: Parallel Programming
Tags: , ,

Use of rand() in OpenMP parallel sections

By Andrey Karpov (54 posts) on November 5, 2009 at 2:57 pm
Comments (4)

The error consists in the fact that every parallel thread has its own seed and if no special initialization is carried out, rand() function will return the same value in all the threads. Most likely, this will not be the required result.

Continued ›

Category: Parallel Programming
Tags: , ,

OpenMP and exceptions

By Andrey Karpov (54 posts) on November 5, 2009 at 2:57 pm
Comments (1)

You can use exceptions inside parallel regions. But they mustn't leave these parallel regions. Exceptions should be caught and processed inside a parallel region by using try/catch. If the exception leaves the parallel region it will cause fail and most surely program crash.

Continued ›

Category: Parallel Programming
Tags: , , , ,

Change of type alignment and the consequences

By Andrey Karpov (54 posts) on November 5, 2009 at 2:56 pm
Comments (0)

When porting software one of the task a developer faces is to change types' sizes and rules of their alignments. Not so long ago we provided support of the diagnosing rule allowing you to detect data structures which use memory on 64-bit inefficiently in Viva64 analyzer. But there is still some research work to be [...]

Continued ›

Category: Software Tools
Tags: , , , ,

Search of explicit type conversion errors in 64-bit programs

By Andrey Karpov (54 posts) on October 22, 2009 at 8:21 am
Comments (0)

On forums I'm constantly asked questions concerning search of incorrect explicit type conversion when porting code on a 64-bit platform. I decided to write this small note so that I could refer people to it and avoid writing the answer every time.

Continued ›

Category: Software Tools
Tags: , , , , ,

Peaceful coexistence of PC-Lint and VivaMP

By Andrey Karpov (54 posts) on October 21, 2009 at 8:20 am
Comments (1)

We are asked different questions relating to using PC-Lint, VivaMP and other static analyzers for testing parallel programs, we are asked if these tools are competitors, and there are many other similar questions. This seems to relate to release of a new version of PC-Lint 9.0 in which support of parallelism analysis is announced.

Continued ›

Category: Parallel Programming
Tags: , , , , ,

Ineffectiveness of last() in the real world

By Andrey Karpov (54 posts) on October 19, 2009 at 8:19 am
Comments (0)

While studying at the institute and learning different data processing algorithms, I already knew that the necessity of using such a function as last() for one-way list can indicate an unfortunate choice of the data structure and lead to ineffective algorithm. Although I knew it long ago, I haven’t faced this in practice until recently.

Continued ›

Category: Software Tools
Tags: , ,

A blog devoted to static code analysis, 64-bit and parallel application development

By Andrey Karpov (54 posts) on October 14, 2009 at 8:42 am
Comments (0)

Hello! With this note we begin our blog on ISN site. "We" is a Russian startup, OOO "Program Verification Systems", http://www.viva64.com . The blog will be conducted by two people - director general Evgeniy Ryzhkov and scientific consultant Andrey Karpov. Our company develops and distributes the static code analyzer PVS-Studio intended for detecting errors in [...]

Continued ›

Category: Parallel Programming
Tags: , , , ,