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?”

Easy way to detect where the C++11/C++14/C++17 features are used in a C++ project : WinObjC 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 “Easy way to detect where the C++11/C++14/C++17 features are used in a C++ project : WinObjC 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.”

Why the C++ modules feature is very important for the C++ future?

C++ have stagnated for many years, and many developers were confident that the language will have the same destiny as Cobol, Fortran and VB6. No new projects will be developed with it and  C++ developers will just do the maintenance of the existing projects. But against all odds, C++ reborn from its ashes and the new standards changes a lot how the language is used. Continue reading “Why the C++ modules feature is very important for the C++ future?”

Elevate your C programming skills by exploring the SQLite codebase.

16 years after its first checkin, SQLite is the most widely deployed database engine in the world. An open source project such as this is a good candidate for learning how to make your code easy to understand and to maintain.

Let’s discover some facts about the SQLite code base, beginning with the following code snippet: Continue reading “Elevate your C programming skills by exploring the SQLite codebase.”

The refactoring overhead costs of the C++ mechanisms over C

Few years ago when Linus Trovalds criticized C++ and told:

inefficient abstracted programming models where two years down the road you notice that some abstraction wasn’t very efficient, but now all your code depends on all the nice object models around it, and you cannot fix it without rewriting your app.

Many C++ developers does not appreciate this opinion. However we must admit that each language facility comes with a price and it’s better to know it than to think that my best programming language is perfect. Continue reading “The refactoring overhead costs of the C++ mechanisms over C”

What Clang can tell you about your Visual C++ projects?

Each compiler could report after the build many warnings. These warnings won’t keep your code from compiling except if you decide to treat them as errors. Don’t hesitate to take a look as these warnings instead of ignoring them. Indeed compiler warnings are often indicators of future bugs that you would see only at runtime.

Clang is a C/C++/Objective C compiler with many interesting features, here are some major end user features:

  • Fast compiles and low memory usage.
  • Expressive diagnostics.
  • GCC compatibility.

Continue reading “What Clang can tell you about your Visual C++ projects?”

Doom3 is the proof that “keep it simple” works.

If you search on the web for the best C++ source code. The Doom3 source code is mentioned many times, with testimonials  like this one.

I spent a bit of time going through the Doom3 source code. It’s probably the cleanest and nicest looking code I’ve ever seen.

Doom 3 is a video game developed by id Software and published by Activision.The game was a  commercial success for id Software; with more than 3.5 million copies of the game were sold. Continue reading “Doom3 is the proof that “keep it simple” works.”