incubator-stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Sebor <>
Subject Re: svn commit: r563682 - in /incubator/stdcxx/trunk/src: once.cpp once.h
Date Tue, 21 Aug 2007 16:37:19 GMT
Farid Zaripov wrote:
>> -----Original Message-----
>> From: Martin Sebor [] 
>> Sent: Tuesday, August 14, 2007 7:39 PM
>> To:
>> Subject: Re: svn commit: r563682 - in 
>> /incubator/stdcxx/trunk/src: once.cpp once.h
>> Thanks for pointing it out! I noticed it too when I tested 
>> the change on Windows but I haven't decided how to deal with 
>> it yet. Compilers often assume that functions with C linkage 
>> don't throw exceptions and generate code that breaks when an 
>> exception does end up being thrown.
>> I think MSVC is one of them, and gcc another. We should 
>> probably add a config test to determine whether a compiler 
>> allows exceptions to pass through C code and only rethrow the 
>> exception only when it does.
>> In the opposite case we'll need to decide how to handle the exception.
>> Any suggestions?
>   Why the internal function should be extern "C"?

So they can be passed to pthread_create() which is in all cases
I know of a C interface (i.e., it expects a pointer to a function
with a C language linkage as an argument). Functions with different
language linkage have distinct types and are incompatible with one
another. Most compilers including MSVC and gcc) don't implement
this rule and as a result present a serious portability problem.
See the following gcc bug report for an example of such a problem:


View raw message