8 ms·
msvc 19.39 is the first to support it, which I mention in the article. You can confirm it didn't work up through 19.38 in godbolt [1]. I don't use Visual Studio
by dhooper 1y ago
msvc 19.39 is the first to support it, which I mention in the article. You can confirm it didn't work up through 19.38 in godbolt [1]. I don't use Visual Studio, so I don't know what version of that first started using msvc 19.39
[1] https://godbolt.org/z/M7zPYdssP https://godbolt.org/z/M7zPYdssP
- wahern 1y agoThis is gonna haunt me. Digging through some old code of mine (circa 2009) I found this bit: #elif _MSC_VER >= 1310 #define typeof(type) __typeof(type) So somehow I had the impression Visual Studio .NET 2003 (7.1)[1] added __typeof. I'm still holding out hope someone will come to my rescue and reply that once upon a time MSVC had __typeof, but removed it. But for now it seems past me is gaslighting present me. [1] See https://learn.microsoft.com/en-us/cpp/overview/compiler-versions?view=msvc-170 https://learn.microsoft.com/en-us/cpp/overview/compiler-vers... for mapping between Visual Studio versions and _MSC_VER. EDIT: Ah ha! It seems Microsoft did support __typeof, but perhaps only for "managed" C++ (aka C++ .NET)? > One thing to watch out for when using the __typeof operator in managed C++ is that __typeof(wchar_t) can return different values depending on the compilation options. Source: https://learn.microsoft.com/en-us/archive/msdn-magazine/2002/february/visual-c-net-tips-and-tricks-to-bolster-your-managed-c-code-in-visual-studio-net https://learn.microsoft.com/en-us/archive/msdn-magazine/2002... (See also https://learn.microsoft.com/en-us/archive/msdn-magazine/2005/july/c-at-work-enum-declarations-template-function-specialization https://learn.microsoft.com/en-us/archive/msdn-magazine/2005...)
- rucikir 1y agoPlaying with MSVC's typeof, I've just discovered that its docs [1] have an example that has never worked with any released version of MSVC... MSVC doesn't support `typeof` applied on function types and function pointers! (bug report [2] [3]). Is there anyone from the compiler team around here? :) [1]: https://learn.microsoft.com/en-us/cpp/c-language/typeof-c?view=msvc-170 https://learn.microsoft.com/en-us/cpp/c-language/typeof-c?vi... [2]: https://developercommunity.visualstudio.com/t/Support-for-typeof-Operator-in-C/10407342#T-N10933706 https://developercommunity.visualstudio.com/t/Support-for-ty... [3]: https://gcc.godbolt.org/z/Kn51qrj99 https://gcc.godbolt.org/z/Kn51qrj99