At 11:59 AM 7/26/01 -0400, Dom Lachowicz wrote:
>****
>Done: Added proper exception handling to the tree
>****
>
>Yes, we now *can* throw and catch C++ exceptions. I've added this header
file to
>the tree about 2 weeks ago but didn't make a fuss about it. Now I am.
>
>Exceptions are good and are your friend, esp. when a constructor fails and we
>can't return an error code (like, say, if an iconv_open fails inside of the
>auto_iconv class). Read through ut_exception.h and see its example usage in
>ut_iconv.[cpp|h]. For now, I only want to use this in constructors that can
>fail. Later, maybe we'll expand its usage.
>
>Exception-handling can be disabled if you pass the correct arguments to
'make'
>(which in turn pass the proper -D flags to CC)
>
>Your build may break due to these changes. Please tidy things up. If your
>compiler doesn't support exception handling, please email the list and let me
>know. I'd like to know exactly what I'm dealing with here.

Since you asked ... 

... command-line Cygwin debug builds using VC 5.0 aren't thrilled about 
this.  Here's the relevant warnings emitted wherever ut_iconv.h is 
included (ie, tree-wide):

  ut_iconv.h(39) : warning C4290: C++ Exception Specification ignored

Likewise, it also complains about the definition:

  ut_iconv.cpp(46) : warning C4290: C++ Exception Specification ignored
  ut_iconv.cpp(126) : warning C4530: C++ exception handler used, 
        but unwind semantics are not enabled. Specify -GX

>From the following explanations in the online help, I *think* the exceptions 
are being ignored properly:

  -------------------------------------------------------------------
  Compiler Warning (level 3) C4290
  C++ Exception Specification ignored

  A function was declared using exception specification.

  At this time the implementation details of exception specification have 
  not been standardized, and are accepted but not implemented in Microsoft 
  Visual C++.

  Code compiled with ignored exception specifications may need to be 
  recompiled and linked to be reused in future versions supporting exception 
  specifications.

  You can avoid this warning by using the warning pragma:

  #pragma warning( disable : 4290 ) 
  -------------------------------------------------------------------
  Compiler Warning (level 1) C4530
  C++ exception handler used, but unwind semantics are not enabled. Specify
-GX

  C++ exception handling was used but the Enable Exception Handling (/GX) 
  option was not selected. 

  When the /GX option has not been enabled, an object with automatic storage 
  in the frame between the function doing the throw and the function 
  catching the throw will not be destroyed. However, an object with 
  automatic storage created in a try or catch block will be destroyed.
  -------------------------------------------------------------------

Since Mike hasn't complained, I assume that VC 6 does handle all this magic 
appropriately.  However, for those of us who aren't feeling like shelling 
out the big bucks to MSFT for a compiler upgrade, I'd like to find a clean 
workaround.  

You mentioned an exception-disabling switch -- I'm assuming that this is 
something we can conditionally set in win32.mak, based on the compiler used? 
If so, what is it?  (I'd hate to be littering XP code with platform-specific 
#pragmas.)

Paul,
fan of warning-free builds


Reply via email to