Marco Foco

namespace override { class override { }; class override_final { ::override::override override; public: virtual ::override::override & final() { return override; } }; } namespace final { class final final : public override::override { }; class final_override final : public override::override_final { ::final::final override; public: ::final::final & final() override final { return override; } }; } …

Continue reading Please, use final and override!

In these days I’m porting a library from Qt4 to Qt5, and here’s how sticking to C++11 syntax has helped me catching a subtle porting problem. I had a class subclassing QTcpServer, overriding a virtual method with this syntax: void incomingConnection(int descriptor) override; Specifying the method as override  was enough to discover a breaking change in …

Continue reading Override and errors

I never managed to remember the match between Visual Studio version, Visual C++ compiler version and Microsoft C/C++ compiler version. I took a minute to collect all the data quite some time to collect all this information, and leave it here for future reference: Product IDE version Solution version Platform toolset _MSC_VER Visual Studio 2017 15.0 …

Continue reading Microsoft Visual C++ version Map

Last week I was playing with C++, trying to rewrite again the “usual” n-dimension Vector/Point/Matrix library. This is an experiment (someone would call it a kata) I did several times mostly as a test bench for language/compiler features I’m learning (e.g. lazy evaluation with expression templates, SIMD intrinsics, etc…). Objects of this library usually represent these entities: Points – …

Continue reading Reinventing the array – preface

Two days ago I was asked to have a look at a nonworking piece of code, based on boost::program_options, which went like this: options_description desc(“Usage”); desc.add_options() (“host,h”, value<string>(), “The host.”) (“file,f”, value<string>(), “This is the file.”); (“mode,m”, value<string>(), “The mode.”); If you don’t recognise the syntax, know that add_options() method of options_description returns a builder object (options_description_easy_init), with an operator () taking three parameters, which …

Continue reading Funny bug #20150127