Boost logo

Boost :

Subject: Re: [boost] Half-baked GIL IO extension review
From: Domagoj Saric (dsaritz_at_[hidden])
Date: 2010-12-07 12:19:17


"Emil Dotchevski" <emildotchevski_at_[hidden]> wrote in message
news:AANLkTimer-e0pFMq977OQWGwCanBZQWGm-8FK8uKBNvr_at_mail.gmail.com...
> On Mon, Dec 6, 2010 at 3:10 PM, Edd Dawson <lists_at_[hidden]> wrote:
>> Looking again at the JPEG code here. As far as I can tell setjmp/longjmp
>> have been used with appropriate care, but I worry what will happen if a
>> method on a Device throws an exception, for example. I've had both Visual
>> C++ 2008 and Apple's g++ 4.0.1 crash on me in this kind of situation.
>
> Did you use -fexceptions with GCC, and if I'm not mistaken MSVC also
> has an option to assume that C functions don't throw exceptions, which
> shouldn't be used for exceptions to work.

Exceptions work just fine without /EHs (at least with MSVC, which also
defaults to extern C=nothrow)...or did you mean in this particular case
(throwing through a C lib)?

Either way, compiling the entire binary with "extern C exceptions" is an
overkill...it is enough to wrap the affected functions in wrappers properly
decorated with "throw (...)"...and in addition, depending on how C++
exceptions are implemented on a particular platform, it may be needed to
recompile the C lib with C++ exception support enabled (no necessary with
MSVC for example)...

 --
"What Huxley teaches is that in the age of advanced technology, spiritual
devastation is more likely to come from an enemy with a smiling face than
from one whose countenance exudes suspicion and hate."
Neil Postman


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk