This post is also available in Italian. As stated in a previous post, final keyword enables the sealing of classes and methods. This is important because it allows interesting compile-time checks, but also enables quite a powerful optimization: the devirtualization. Devirtualization happens when the compiler can statically decide, at compile time, which function should be called, so it can produce …
Continue reading The power of devirtualizationVisual Studio
Discussing with another C++ programmer, we came out with this piece of code: #include <iostream> template <class… Args> void foo(int, Args…) { std::cout << “1”; } template <class…Args> void foo(Args…, int) { std::cout << “2”; } int main() { foo(11); // A foo<>(11); // B foo(11, 33); // C foo<int>(11, 33); // D foo(11, 22, 33); // E foo<int, int>(11, 22, 33); // F } I was pretty convinced that all the calls to foo were ambiguous, so I decided to test it with different …
Continue reading Curiosity #20160225I 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(s) Platform toolset _MSC_VER Visual Studio 2019 …
Continue reading Microsoft Visual C++ version Map