|
|
|
|
|
by didroe
4375 days ago
|
|
It's much simpler than that. It actually makes writing a compiler easier as you have higher level abstractions to work compared to generating machine code. There are many languages that compile to C which should prove to you that it can be done. I don't see why targeting C++ would be any different and I'm sure there are languages already out there that do. |
|
The moment you include dynamic dispatch, auto-conversion to big integers, or one of a zillion of other high-level features without also introducing ways for the programmer to indicate how the compiler should implement them, you give up being just as fast as C/C++.
Yes, the difference may be small, and spending time on improving your compiler can make it smaller and smaller, but for any 'real world program', it won't be zero.
The same is true for C vs assembly, but there, the difference mostly _is_ small because C has none of those high-level features.
Also, few people have the skills and the time to wrote well-optimized C/C++.