unexpected_handler not a member of std. stlport 5.1.5 vs2005
Brought to you by:
complement
In visual studio 2005 using stlport 5.1.5 (and earlier 5.1 versions), the functions unexpected_handler and set_unexpected are not members of the std: namespace, but are in the namespace :
Test case:
#include <exception>
std::unexpected_handler old;
UnknownExceptionHandler(std::unexpected_handler nh = handler)
{
old = std::set_unexpected(nh);
}
OPERATIONAL ENVIRONMENT
Visual Studio 2005, SP1
COMPILER VERSION
MSVC 8
STLPORT VERSION
5.1.5
RESULT OF UNIT TESTS
Pass.
One of the consequences of this is to break the use of swig generated python bindings using directors.
Logged In: YES
user_id=1096600
Originator: NO
MSVC do not support set_unexpected function so STLport do not import it in its own namespace to make it clear. If you really want to have it in STLport namespace, comment _STLP_NO_UNEXPECTED_EXCEPT_SUPPORT in stlport/stl/config/host.h.
Logged In: YES
user_id=1276883
Originator: YES
I'm sorry, I don't quite understand.
What do you mean by "MSVC do not support set_unexpected function"? Do you mean stlport does not support using it with MSVC? Or do you mean it is not supported by Microsoft in some way?
set_unexpected *is* in the MSVC documentation here, and use of it seems to work when compiling without stlport, so I suspect it is supported by Microsoft, at least in MSVC8.
The macro you mentioned is documented solely by:
/* This section contains swithes [should read switches] which should be off by default,
* but so few compilers would have it undefined, so that we set them here,
* with the option to be turned off later in compiler-specific file
*/
I don't entirely understand what this means, so could you please provide a little more information? Does this macro do nothing except pull set_unexpected into the std namespace, or could it have side-effects?
Logged In: YES
user_id=1096600
Originator: NO
set_unexpected is not correctly supported by MSVC, STLport cannot do anything for it. This C++ feature highly rely on compiler support, it is impossible to simulate it from library code. The comment next to _STLP_NO_UNEXPECTED_EXCEPT_SUPPORT means that MSVC is not the only compiler to miss this function support. Most compilers do not even consider functions exception specification except when you say that the function do not throw at all.
Yes, _STLP_NO_UNEXPECTED_EXCEPT_SUPPORT simply add the set_unexpected function in STLport namespace so that you will be able to use std::set_unexpected in your code. But if you do so, build and run unit tests coming with STLport. There is a test to check that set_unexpected is correctly supported in exception_test.cpp, you can see here what I mean when I say that it is not correctly supported.
Logged In: YES
user_id=1312539
Originator: NO
This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 14 days (the time period specified by
the administrator of this Tracker).