You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stdcxx.apache.org by Farid Zaripov <fa...@apache.org> on 2009/08/18 10:53:24 UTC

Re: svn commit: r777603 - in /stdcxx/branches/4.2.x: etc/config/src/ src/

>> Actually, the MSVC 10.0 beta libc contains dtor's for std::length_error
>> and std::logic_error only (at least in 15s configuration which I've
tested).
>> It is still beta for now, but I believe that these dtors will go to the
>> release.
>> 
>> Or should I fill the bug report to Microsoft on that issue?
>
> That would be great, thanks! With dtors for arbitrary C++ Standard
> Library in their libc there's no way to build/use a third party
> implementation such as stdcxx. Imagine one of the dtors doing
> something to the class, e.g.:
>
>    class length_error: runtime_error {   // MSVC 10 definition
>        char* data;
>    public:
>        virtual ~length_error () { delete[] data; }
>        // ...
>    }

  I've filled the issue to MS, but today they resolved this issue
with status "by design" :(

http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?Feedbac
kID=457862

Best Regards,
Farid Zaripov


RE: svn commit: r777603 - in /stdcxx/branches/4.2.x: etc/config/src/ src/

Posted by Farid Zaripov <fa...@apache.org>.
> -----Original Message-----l
> From: Martin Sebor [mailto:msebor@gmail.com] 
> Sent: Wednesday, August 26, 2009 1:02 AM
> To: dev@stdcxx.apache.org
> Subject: Re: svn commit: r777603 - in /stdcxx/branches/4.2.x: 
> etc/config/src/ src/
> 
> I'm not sure I understand what they are proposing we do in 
> the MSVC bug report. Do you?

  As I understand they are telling that if std::length_error dtor is defined
in
application, in this case the application will be linked without errors and
overridden std::length_error dtor will be used.

  In our case the std::length_error dtor is defined in library, that's why
linker issues the "multiple symbols defined" error.

  To avoid this error we can define std::length_error dtor as inline, to
define it in user's application and override the dtor from libc.

Farid.


Re: svn commit: r777603 - in /stdcxx/branches/4.2.x: etc/config/src/ src/

Posted by Martin Sebor <ms...@gmail.com>.
On 08/18/2009 02:53 AM, Farid Zaripov wrote:
>>> Actually, the MSVC 10.0 beta libc contains dtor's for std::length_error
>>> and std::logic_error only (at least in 15s configuration which I've
> tested).
>>> It is still beta for now, but I believe that these dtors will go to the
>>> release.
>>>
>>> Or should I fill the bug report to Microsoft on that issue?
>>
>> That would be great, thanks! With dtors for arbitrary C++ Standard
>> Library in their libc there's no way to build/use a third party
>> implementation such as stdcxx. Imagine one of the dtors doing
>> something to the class, e.g.:
>>
>>     class length_error: runtime_error {   // MSVC 10 definition
>>         char* data;
>>     public:
>>         virtual ~length_error () { delete[] data; }
>>         // ...
>>     }
>
>    I've filled the issue to MS, but today they resolved this issue
> with status "by design" :(

That's very bad. In stdcxx, length_error and all other exception
classes described outside of [lib.language.support] derive from
an intermediate base class, __rw::__rw_exception, which takes
care of memory management on their behalf. Failing to define
the destructors of these classes and invoking those defined in
MSVC's runtime library will, in addition to exposing programs
to the risk mentioned above, bypass the memory management
functions in stdcxx and lead to leaks.

I'm not sure I understand what they are proposing we do in the
MSVC bug report. Do you?

Martin

>
> http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?Feedbac
> kID=457862
>
> Best Regards,
> Farid Zaripov
>