4 ms·
This nicely demonstrates the main design blunder of the Universal Windows Platform: introducing an incompatible dialect of C++ (called C++/CX, formerly known as
by flohofwoe 11y ago
This nicely demonstrates the main design blunder of the Universal Windows Platform: introducing an incompatible dialect of C++ (called C++/CX, formerly known as C++/CLI, formerly known as Managed C++).
I really wonder why Microsoft had to invent their own, incompatible C++ dialect when projects like emscripten can cross-compile perfectly standard C++ to Javascript, which is a much more exotic compile target than the .NET runtime.
- deleted 11y ago[deleted]
- skrebbel 11y agoPerformance. An emscripten-like project could probably never generate IL that's as fast as the output of hand-ported C++. Or, at least, that must've been a sane opinion to hold back when managed c++ was first invented.
- pavlov 11y agoConfusingly, C++/CX is actually not for the .NET runtime, so it's not a successor to C++/CLI. Instead C++/CX targets the traditional COM platform which goes back decades and was kind of resurrected as the foundation of WinRT (and whatever it's called in Windows 10 -- UWP I guess? I have trouble following these rebrandings). As far as I've understood, the point of C++/CX is somewhat similar to Objective-C. You can still write raw COM code in plain C or C++ (just like you can use the Obj-C runtime from plain C if you really want to)... But C++/CX is there to make it more palatable.
- nikbackm 11y agoYou also don't need to use C++/CX in order to write UWP applications, there are several other bindings available [0]. There even exists a non-Microsoft made binding [1]. [0]https://en.wikipedia.org/wiki/Windows_Runtime#Programming_interfaces https://en.wikipedia.org/wiki/Windows_Runtime#Programming_in... [1] http://moderncpp.com/about/ http://moderncpp.com/about/
- notreallyright 11y agoC++/CX is a convenience syntax for creating and working with types in the windows runtime. In all of the talks given by Herb Suttor, a MS employee and active member of the C++ standards committee, he says to use it at ABI boundaries and use standard C++ everywhere else. If that's not good enough for you there is also Mondern C++ by Kenny Kerr which is a C++1x projection of the windows runtime.
- flohofwoe 11y agoYes, I think that makes the most sense to keep C++/CX language constructs isolated to only a few places that need to talk to the UWP APIs, similar to how one would contain Objective-C(++) when talking to OSX APIs to only a few places.
- Const-me 11y agoJust because the author of this particular library picked C++/CX does not mean you have too. I prefer developing native parts in C++ without CX. Compile classic C++ DLL. Then I use a combination of C-style [DllImport]-ed functions, and COM-style IUnknown-derived objects. This approach works fantastic for a whole bunch of Microsoft’s APIs like Direct3D and Media Foundation. I don’t see why not use the same approach in designing custom DLLs.