| > there was no DirectX SDK for Sega Saturn. 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. |
I think either I don't understand something you are trying to say or you are confused. C being a subset of C++ (one of design goals) does not imply C++ is a subset of C. C++ code in general cannot be compiled with C compiler without rewriting.
>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.
You have blah->Foo(bar); in C++. In C it won't compile by any design. That code has to be rewritten as blah->vtbl->Foo(blah,bar). It is not C code as you claimed. It won't compile with C compiler. It's C++.
>> Could you explain exactly how this works? ... >1 - Rename .c translation units to .cpp, .cxx, .C
I asked how type checking disappears in this process, not how you compile C with C++....
>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.
How can a JIT compiler obtain the PGO data in the first place? Is it running under profiler all the time? You realize that you've just refuted your claim about performance not being affected, right?