stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Sebor <se...@roguewave.com>
Subject Re: svn commit: r565959 - /incubator/stdcxx/trunk/etc/config/src/EXTERN_C_EXCEPTIONS.cpp
Date Wed, 15 Aug 2007 01:19:00 GMT
Travis Vitek wrote:
> Martin,
> 
> I'm not sure if you're aware, but I don't believe that the destructors
> for stack objects inside the C functions will be called. I know that
> this is the case for MSVC7/8. This isn't an issue for your testcase, but
> it may be an issue for the functions invoked by __rw_once.

Interesting! I didn't know about this limitation. It's something
we need to keep in mind when writing the initialization functions.
Perhaps the solution will be to require the initialization function
to have the empty exception specification. That way we could rely
on the compiler to detect initialization functions that can throw.

> 
> I think this is by design, but I found it a little weird that the ascii
> value of the first character of each parameter is passed to
> div_throw/div_nothrow. I had the urge to add modify the argument
> processing lines to something more like this so that I could pass
> arguments and get the expected results.

Yeah, it doesn't make much sense. The only reason for the code
is to try to prevent overachieving optimizers from generating
C++ code for the C functions and doing "the right thing" in
the simple test case. I should add a comment explaining this.

Martin

> 
>     const int x = argc < 2 ? 0 : int (*argv [1]) - '0';
>     const int y = argc < 3 ? 0 : int (*argv [2]) - '0';
> 
> Travis
> 
>> Author: sebor
>> Date: Tue Aug 14 15:48:02 2007
>> New Revision: 565959
>>
>> URL: http://svn.apache.org/viewvc?view=rev&rev=565959
>> Log:
>> 2007-08-14  Martin Sebor  <sebor@roguewave.com>
>>
>> 	* EXTERN_C_EXCEPTIONS.cpp: New config test to determine whether
>> 	it's possible to throw exceptions from functions with C language
>> 	linkage.
>>
>> Added:
>>    
>> incubator/stdcxx/trunk/etc/config/src/EXTERN_C_EXCEPTIONS.cpp  
>> (with props)
>>
>> Added: incubator/stdcxx/trunk/etc/config/src/EXTERN_C_EXCEPTIONS.cpp
>> URL: 
>> http://svn.apache.org/viewvc/incubator/stdcxx/trunk/etc/config/src/EXTE
> RN_C_EXCEPTIONS.cpp?view=auto&rev=565959


Mime
View raw message