[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference turris::digital_unix

Title:DIGITAL UNIX(FORMERLY KNOWN AS DEC OSF/1)
Notice:Welcome to the Digital UNIX Conference
Moderator:SMURF::DENHAM
Created:Thu Mar 16 1995
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:10068
Total number of notes:35879

8958.0. "About exception handling on Digital UNIX V3.2 ..." by TAEC::GALLERI () Tue Feb 25 1997 12:43

Hi,

As far as I know, there are at least 4 different ways to handle
exceptions (and especially, synchronous signals as exceptions)
on Digital UNIX V3.2:

1) with the Ada language ;
2) with the C++ language ;
3) with the DECthreads Exception Package ;
4) with the Exception Handling Library.

And, as far as I know too, these exception handling schemes are not
compatible between each other (Well, I don't know precisely to which
extent, but, at least, I have experimented this between DECthreads
and the three others 8-(

Now, I was told that this would be solved with Digital UNIX V4.0.

My questions are the following :

 * is it true with V4.0B ? if not, with which release will it be
   the case ? and when ?

 * does - or will - this "unified exception handling mechanism" encompass
   every cases of interoperability ?

Indeed, we can easily ;-) imagine the following scenario :

// pthread_create'd routine :

  TRY
  {
    ...

    // call an Ada written routine :

      ADA_BLOCK :
      begin

        ...

        -- call a C or C++ routine

          try
          {
            ...
          }

            ...
          }
          catch/except
          {
            ...
          }

        ...

      exception

        ...

      end ADA_BLOCK ;

    ...
  }
  CATCH
  {
    ...
  }
  ENDTRY


So, our requirement is that each function level could rely on the
underlying exception handling mechanism to make its own exception
statements work no matter the exception cause is (namely, a user-
defined exception explicitely thrown or a synchronous signal being
delivered by the system).

I'll be waiting for your comments/answers on this before coming
with other questions on the matter ;-)

Thank you very much for your attention,

Xav
T.RTitleUserPersonal
Name
DateLines
8958.1some infoDECC::SEIGELTue Feb 25 1997 17:0733
  Ada, C (SEH), C++, and the native exceptions facility (libexc) all work
  fine together (even before V4.0) because Ada, C, and C++ exceptions are
  layered on top of the native exceptions facility.  They can co-exist
  in the same program and catch each other's exceptions.  If an Ada or
  C exception propagates thru a C++ frame, the C++ runtime handler will
  make sure the proper destructors get called.

  DECthreads exceptions were a problem because they used their own
  home-grown mechanism.  However, as of V4.0, DECthreads exceptions
  now also uses libexc.

  However, there are some things you should keep in mind:

  1. You cannot use DECthreads exception mechanisms inside of an Ada
     function.  I doubt it will even compile.

  2. As of v4.0, DECthreads handlers can catch Ada, C, and C++
     exceptions, and vice-versa.

  3. You might want to avoid using DECthreads exceptions support in a
     function that also uses C or C++ exceptions support.  I think it
     is supposed to work, but it may still have problems.

     Note that C++ provides implicit exception handling to ensure
     that destructors get called.  Hence, you should be careful
     about using DECthreads exception support in C++.


  If you had more specific questions, they might be easier to answer.
  For example, what exactly are you looking for in terms of
  inter-operability ?

  Harold