Why should you care about C/C++ static analysis?

Many resources discuss the benefits of using the static analysis tools, and how they could help you  improve your code base.  Somehow they show you what you could gain after using them. But did you asked yourself what do you lose if you don’t use them?

Let’s take an example of a memory corruption due to  free of a pointer twice, this cause random crash. It could take few hours or maybe many days to find this kind of issue. Many similar risky problems exist in C/C++ specially concerning memory corruption.  Just one problem could cost few dollars or many thousands of dollars. Continue reading “Why should you care about C/C++ static analysis?”

Two easy approaches to leverage your C++ OOP design skills.

Coupling is usually contrasted with cohesion. Low coupling often correlates with high cohesion, and vice versa. Low coupling is often a sign of a well-structured computer system and a good design, and when combined with high cohesion, supports the general goals of high readability and maintainability. The goal of this case study is to show the benefits of loose coupling and high cohesion, and how it can be implemented with C++. The case study consists of designing an application that accesses a file in order to get data, processes it, and prints the result to an output file. Continue reading “Two easy approaches to leverage your C++ OOP design skills.”

C++11/C++14/C++17 Features in WinObjC: A Case Study

In a previous post we talked about the clang-tidy tool to detect where you can use some new C++11/C++14/C++17 features to modernize your C++ source code.  But how we can easily detect where the new C++ features are used in a project?

Facebook and Google use intensively C++11 in their source code. Folly from Facebook as we discovered in a previos post use almost all the C++11 features and I was curious to know if Microsoft also use the new  C++11 standards in their open sourced code. Continue reading “C++11/C++14/C++17 Features in WinObjC: A Case Study”

Improve your C++ skills by exploring the Clang test suite.

Many resources exist talking about the better way to learn a programming language, we can enumerate:

  • Reading a book or a magazine.
  • Resources from web sites.
  • From a collegue.
  • Doing a training.
  • Explore open source projects.

However it’s difficult to find resources that explains easily the  advanced C++ techniques using mini samples and if you are interested to improve your C++ skills, it’s recommended to explore the standards which is a very difficult task, few developers could read a big pdf with more than 1500 pages. Continue reading “Improve your C++ skills by exploring the Clang test suite.”

Easily detect where you can modernize your C++ codebase.

C++11/C++14/C++17  includes several additions to the core language and extends the C++ standard library. Some of these new features are very easy to use and bring a big added value to your C++ projects.

It’s interesting to detect automatically places where we can use some C++11 new features. For such needs clang-tidy is a standalone tool used to automatically convert C++ code, written against old standards, to use features of the newest C++ standard where appropriate. 

Developers who utilze Clang could easilly use the clang-tidy tool. However for Visual C++ developers and other compilers users it’s not an easy task to benefit from this interesting tool result.

To let all C++ developers benefit from this amazing tool, CppDepend is integrating it now in its latest windows version 2018.1 in order to detect the places where the following features could be used: Continue reading “Easily detect where you can modernize your C++ codebase.”