S
Steven T. Hatton
I'm forking this from a reply to John Nagle in the smart_ptr<> thread.
To address some of the problems handled by the runtime environments of C#
and Java, it may be necessary to look beyond the C++ Standard. I believe
Microsoft post-DOS OSs are capable of detecting a null pointer access, and
throwing an exception to the program that attempted it. I've raised this
issues on the GCC mailing list (or newsgroup - I don't recall which), and
believe there was some interest in addressing the problem for other
environments. This discussion may suggest a way of doing the same for
Linux.
http://netlab.ru.is/exception/LinuxCXX.shtml
This really is the domain of the C++ ABI, and not the language standard.
There may be room in the standard for improving the language side of the
interface. I don't know.
My personal opinion is that there is no need for two (or three) languages to
create the kinds of products written in Java or C#. There may be a real
role for managed C++ and the CRL, such as creating C++ 'applets' in the
spirit of Java applets. The Java code to produce these animated graphics
is quite minimal, and uses nothing beyond the basic Java libraries:
http://mathworld.wolfram.com/topics/LiveGraphics3DApplets.html
Using Java3D I have created more sophisticated 3D applications which I can
share over the Internet as long as the person on the other end cares to
install Java3D. Although Java3D does have a bit of platform specific code,
the JVM makes porting it far easier than it might otherwise be. I can
therefore share my applets with people using different platforms without
any consideration of their platform on my part.
Clearly, in order to accomplish the same with C++ there would be a need to
restrict the available language features to those which do not require
direct access to system resources. Unfortunately, as I understand things,
managed C++ also adds non-standard features to the language. These
additions probably enhance the usability of the language in the CLR
environment, but they also represent a fork potentially leading to two
similar, yet incompatible languages.
One last comment on garbage collection. It's not a panacea. Though I never
actually got to the point of needing to address the problem, the Java3D
literatue discusses approaches to managing discarded objects; something
that is forced on C++ programmers. Though I believe C++ could and should
do a far better job of facilitating memory management, the fact that a C++
programmer has to take resource management seriously makes a C++ programmer
a better programmer.
To address some of the problems handled by the runtime environments of C#
and Java, it may be necessary to look beyond the C++ Standard. I believe
Microsoft post-DOS OSs are capable of detecting a null pointer access, and
throwing an exception to the program that attempted it. I've raised this
issues on the GCC mailing list (or newsgroup - I don't recall which), and
believe there was some interest in addressing the problem for other
environments. This discussion may suggest a way of doing the same for
Linux.
http://netlab.ru.is/exception/LinuxCXX.shtml
This really is the domain of the C++ ABI, and not the language standard.
There may be room in the standard for improving the language side of the
interface. I don't know.
My personal opinion is that there is no need for two (or three) languages to
create the kinds of products written in Java or C#. There may be a real
role for managed C++ and the CRL, such as creating C++ 'applets' in the
spirit of Java applets. The Java code to produce these animated graphics
is quite minimal, and uses nothing beyond the basic Java libraries:
http://mathworld.wolfram.com/topics/LiveGraphics3DApplets.html
Using Java3D I have created more sophisticated 3D applications which I can
share over the Internet as long as the person on the other end cares to
install Java3D. Although Java3D does have a bit of platform specific code,
the JVM makes porting it far easier than it might otherwise be. I can
therefore share my applets with people using different platforms without
any consideration of their platform on my part.
Clearly, in order to accomplish the same with C++ there would be a need to
restrict the available language features to those which do not require
direct access to system resources. Unfortunately, as I understand things,
managed C++ also adds non-standard features to the language. These
additions probably enhance the usability of the language in the CLR
environment, but they also represent a fork potentially leading to two
similar, yet incompatible languages.
One last comment on garbage collection. It's not a panacea. Though I never
actually got to the point of needing to address the problem, the Java3D
literatue discusses approaches to managing discarded objects; something
that is forced on C++ programmers. Though I believe C++ could and should
do a far better job of facilitating memory management, the fact that a C++
programmer has to take resource management seriously makes a C++ programmer
a better programmer.