| >The major C++ SDK was the DirectX SDK for the Sega Saturn. a) there was no DirectX SDK for Sega Saturn.
b) DirectX SDK (including one for Sega Dreamcast) is not C++. It has C++ bindings but is usable from C. >Yes, the code was basically C compiled with C++ compiler. You mean if I have taken that code and compiled with C compiler it worked? You realize even the DirectX C++ wrapper is not already C, right? You know classes, overloads, namespaces are not C? >Not when what most write is actually C compiled with C++ compiler. Could you explain exactly how this works? The C++ compiler uses ML to recognize that the code is not exactly following Alexandrescu's book and turns off typechecks? I seriously just don't understand what you mean here. I usually take "C compiled with C++ compiler", "C with classes" etc as "not enough GoF patterns for my taste" but you are making some other claim here it seems. >If you don't want the GC to move memory around then don't allocate it via the GC. So, why do you want GC in the first place? For types, which somehow disappeared from C++? >No, but JITs can also make use of PGO just like AOT compilers. How exactly does it work? The code stops executing for a week, the profiler gets run to under user credentials and then JIT finally decides? |
Broken memories, I didn't bother to search for it (Saturn vs Dreamcast).
> You mean if I have taken that code and compiled with C compiler it worked?
Of course it would, that was one of the design goals of C++.
C90 is mostly a C++98 subset, except for stronger type conversion rules (no implicit void* conversions), precedence order for operator ?: and typedef/struct namespaces.
> You realize even the DirectX C++ wrapper is not already C, right? You know classes, overloads, namespaces are not C?
Yes, but COM is also callable from C by design. Also I have seen many codebases that have restricted C++ code to calling DX APIs, with everything else being compilable by a C compiler as well.
> Could you explain exactly how this works? ...
1 - Rename .c translation units to .cpp, .cxx, .C
2 - Invoke C++ compiler on them
3 - Fix compiler errors related to semantic differences in C subset of C++
4 - Forbid use of any C++ specific feature beyond those required to use the OS SDK.
> So, why do you want GC in the first place? For types, which somehow disappeared from C++?
Productivity.
> How exactly does it work? The code stops executing for a week, the profiler gets run to under user credentials and then JIT finally decides?
PGO data generated by the JIT compiler gets updated after each application execution and is used as input for optimization selection just like in an AOT compiler by a multi-stage compiler.
Feel free to read Android 7 ART source code to learn how about a possible implementation.