Why can\'t a compiler be written that manages what needs to be managed in C++ code (i.e. to make it \"CLR compatible\")?
Maybe with some compromise, li
first thing to consider is
every thing that makes c++
"fast" will disappear.
a full garbage collection system in c++ is next to impossible.
because c++
you can have pointer nearly anywhere in the code.
runtime type information becomes costly if not directly built into the
langauge system it self.
you can take advantage of true native performance.
template will dissappear. true pointers will dissapear.
direct access to memory is gone.
list of things that would have to be enforced
1. no direct pointers(pointers will get replace with complex refernces)
2. templates (generics pay for preformance)
3. simple c-style arrays (will get wrapped with array structures)
4. programmer no longer has control of whether data is on the stack or
the heap.
5. garbage collection will be enforced(this will cause the most changes to the syntax)
6. runtime type data will get added extensively to the code.
(larger code size)
7. inlining will become more difficult for the compiler
(no more inline key word)
8. no more inline assembly.
9. the new langauge by now will become incompatible c code.(unless you go through hoops)