A small post about the Casablanca project

Andrey Karpov
Articles: 565

The post is small because this is a rare case when we find almost no errors in a project when checking it with PVS-Studio. However, we've decided to write about this project for the world to know its heroes.

We regularly check various open-source projects and write posts about it. Developers are of course informed about the results. We haven't got much time to check projects recently, as we were very busy providing support for Embarcadero C++Builder 2009-XE3. But now we continue our traditional checks. It is especially interesting now that our tool has learned to analyze even more diverse projects. If you know any open-source projects for C++Builder that might be of interest to us, please let us know.

In the past we didn't write about projects in which nothing (or almost nothing) of interest had been found. But we have concluded that it's unfair. I'm sure that authors of clear projects will be pleased to know that we have appreciated the quality of their code highly.

The first project among these we'd like to tell you about is C++ REST SDK (codename "Casablanca"). This is a good code written in a contemporary style employing capabilities of C++11. We have checked it using our static code analyzer PVS-Studio and failed to find at least one significant bug. Our respect to the Microsoft developers who have created this library!

The analyzer has found only errors made deliberately for the testing purpose. For example, it has generated the warning "V539 Consider inspecting iterators which are being passed as arguments to function 'for_each'. test_runner.cpp 551" for the following code:

const std::vector<std::string> & failed =
std::for_each(failed.end(), failed.end(),
              [](const std::string &failedTest)
    std::cout << "**** " << failedTest
              << " FAILED ****" << std::endl << std::endl;

There were some other special test errors, but there's no point telling about them.

The only fragment that could be scarcely called an error is this one:

bool _close_fsb_nolock(....)
  if ( fInfo->m_buffer != nullptr )
    delete fInfo->m_buffer;       
  delete fInfo;

The following code should have been most likely written instead:

delete fInfo->m_buffer;       
fInfo->m_buffer = 0;

But it's not that important, as the object located by the address 'fInfo' gets destroyed anyway. There are a couple of other fragments we could pick on, but it's not serious.

So our praise and a virtual medal go to the developers of Casablanca!


Use PVS-Studio to search for bugs in C, C++, C# and Java

We offer you to check your project code with PVS-Studio. Just one bug found in the project will show you the benefits of the static code analysis methodology better than a dozen of the articles.

goto PVS-Studio;

Andrey Karpov
Articles: 565

Bugs Found

Checked Projects
Collected Errors
14 526
This website uses cookies and other technology to provide you a more personalized experience. By continuing the view of our web-pages you accept the terms of using these files. If you don't want your personal data to be processed, please, leave this site. Learn More →