On Sat, 11 Sep 2004 20:46:47 -0400
"Steven T. Hatton"
I really didn't think very hard about the topic before I posted. I immediately realized it was potentially important, and wanted to call it to the attention of others. You are correct in bringing up signals. My understanding is, the way traditional Java deals with null pointer access is by checking all access for you. It (the JVM) /is/ the OS. I wonder how the GNU Java compiler deals with exception handling?
I really don't know how Unix signals affect the execution of my C++ programs - other than the fact they crash when receiving SIGSEGV. I guess the signal handling is part of the gcc implementation. So the mechanism for "exception registration" would need to be part of the compiler implementation. It would be nice to have such functionality defined in a platform-independent way.
In order for something like this to work, the signal would have to cause an exception to be thrown to the errant function, or at least from that function. I think I might post this to the GCC mailing list.
Theoretically, a program written in C++ that adheres to the C++
standards should be portable, but we all know that various systems tend
to add "features". C++ also supports signals. There are also standard
exceptions that are defined in C++. (Look at the header file stdexcept).
But, in any case, there is a catch all clause.
--
Jerry Feldman