C++ Tips

C++ Tools - Deleaker

I’ve just purchased a license for Deleaker by Softanics. I found out about the tool from Bartek’s coding blog where he writes about the tool here. I downloaded the trial edition and it found quite a few subtle issues in some of my unit test code. Nothing too serious, but stuff that other tools have missed. The run-time overhead doesn’t appear to be that great, my server tests still run at a reasonable speed and nothing fails because of the instrumentation.

C++ Tools - CppDepend - 2017 update...

I’ve been trying various static analysis tools on the C++ code of The Server Framework. I’ve now been using Resharper C++ quite regularly for over a year and I still use the Gimpel PC-Lint Plus Beta on a regular basis. I haven’t used CppDepend as much, mainly because once I’d fixed the issues that it raised, and that I decided I needed to fix, I pretty much left it alone. This is possibly because I run it as an external tool and I run both Resharper and PC-Lint as fully integrated Visual Studio extensions.

C++ Tools - JetBrains ReSharper C++ - purchased...

I’ve been looking at Resharper C++ by JetBrains for a while now and the trial period has finally run out. I immediately bought a license which shows how my feelings have changed about the product during the trial. Initially I found that the tool got in my way too much, I still find it a little sluggish at times but I think that my initial tests were hurt by the fact that I was running multiple copies of Visual Studio (as is my way) with multiple large projects and generating code inspection reports in all of them at the same time… Well, that’s how I’d want to use it… Anyway, when limiting myself to one or two concurrent instances things were better.

C++ Tools - CppDepend

I’ve been trying various static analysis tools on the C++ code of The Server Framework. So far I’m using Resharper C++ and the Gimpel PC-Lint Plus Beta on a regular basis and I’ve now added CppDepend into the loop. Full disclosure. I have been given a CppDepend license. As I’ve said before, whilst CppDepend is easy to get hold of, easy to install and “just works” I don’t find it that useful.

C++ Tools - JetBrains ReSharper C++ is slowly winning me over

I’ve been looking at Resharper C++ by JetBrains for a while now and I expect I’m nearing the end of the trial period. Initially I found it got in my way but slowly I think it’s training me to ignore the niggles and I’m finding the functionality quite compelling. At present, I’m most interested in the “code inspection” report from Resharper. Comparing it to the similar functionality in PC-Lint and CppDepend, etc.

C++ Tools - Some thoughts on JetBrains ReSharper C++

Following on from my rant about C++ tooling and its follow up. I’ve been looking at JetBrains ReSharper for C++. This isn’t a review, more just my initial thoughts. TL;DR I’d like to like it. It does some good things but it also gets in my way and slows me down. ReSharper is a Visual Studio add-in. In general I don’t like add-ins but this comes from my years working short contracts and multiple clients where it was easiest to be at home in a clean Visual Studio installation as no two clients would have the same add-ins installed.

Living with Gimpel Lint is made so much easier with Visual Lint

I’ve been a big fan of Gimpel Lint for years. It’s a great static analysis tool for C++ and it can locate all kinds of issues or potential issues in the code. My problem with it has always been that it’s a bit of a pig to configure and run, more so if you’re used to working inside an IDE all the time. Several years back I had some custom Visual Studio menu items that I’d crufted up that ran Gimpel Lint on a file or a project and some more cruft that converted the output to something clickable in the IDE’s output pane.

Intrusive C++ containers

Recently, whilst continuing to improve the performance of various aspects of The Server Framework, I reached a point where I found I needed to replace some STL containers with intrusive containers which didn’t need to perform memory allocations during data insertion and removal. I had been toying with the idea of implementing custom containers for some time but have only recently had a pressing need for them. The STL provides some marvellously usable code which has changed the way people view container classes in C++.

Bitten by 'scoped static initialisation' in C++ - turn on Visual Studio's C4640 warning!

Today I discovered that C++ scoped static initialisation (function level) in Visual Studio is not done in a thread safe manner. It’s the kind of thing that I should have already known but I guess I assumed that since namespace level static initialisation was safe so was function level static initialisation. Unfortunately it’s not. If you read the MSDN documentation in a particular way you could decide that the docs say that it’s not; but it’s imprecise and unclear and I doubt that I did read the MSDN documentation anyway.

Visual Studio 2013 Preview - isprint() incorrectly classifies ' ' as printable for 'C' locale.

It seems that `isprint() is broken. The following program demonstrates the problem. In VS20013 it prints “test failed” in all previous versions of visual studio it prints “test passed”. From this reference: http://en.cppreference.com/w/cpp/string/byte/isprint it seems that VS2013 is broken. I’ve opened a Microsoft Connect issue for this. #include <ctype.h> #include <iostream> int main() { int c = 9; if (isprint(c)) { std::cout << "test failed" << std::endl; } else { std::cout << "test passed" << std::endl; } return 1; }