Home Dashboard Directory Help
Search

VS2012 C++ exception warning on xlocale by bubu


Status: 

Closed


2
0
Sign in
to vote
Type: Bug
ID: 776348
Opened: 1/11/2013 10:03:10 AM
Access Restriction: Public
0
Workaround(s)
view
0
User(s) can reproduce this bug

Description

If you disable exceptions in a C++ ( non-managed ) project and you include some STL headers like <string>, <vector>, <functional>, <algorithm>, etc... you'll get this warning:

D:\vs2012\VC\include\xlocale(336): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc

which is absurd, because I really don't want to use C++ exception explicitly.

thx.
Details
Sign in to post a comment.
Posted by occor on 5/21/2013 at 11:28 AM
While the STL does expect exceptions to operate as part of the spec, every other header in the library supports the _HAS_EXCEPTIONS macro except for xlocale. Please reconsider adding support for this macro into xlocale to keep Microsoft's STL implementation consistent with itself.

As it stands now, projects that use the STL in a limited capacity and have exceptions disabled for performance reasons are inundated with this warning for xlocale. This warning is critical for ensuring the correctness of a project's code as any exceptions will not work, so the warning cannot be disabled.
Posted by Microsoft on 1/14/2013 at 2:24 PM
Hi,

Thanks for reporting this issue. I've resolved it as By Design because exception handling is a mandatory part of the C++ Standard. Although the compiler provides an option to disable exception handling, we do not attempt to support this non-Standard mode in our C++ Standard Library implementation. Similarly, while the compiler can disable RTTI, we don't attempt to support that in the Standard Library. (One exception to this rule is that we currently support /Zc:wchar_t- in the Standard Library, although that may change in the future.)

Note: Connect doesn't notify me about comments. If you have any further questions, please E-mail me.

Stephan T. Lavavej
Senior Developer - Visual C++ Libraries
stl@microsoft.com
Posted by Microsoft on 1/13/2013 at 10:33 PM
@bubu,Thank you for submitting feedback on Visual Studio and .NET Framework. Your issue has been routed to the appropriate VS development team for investigation. We will contact you if we require any additional information.

@UnitUniverse, thanks for your response.
Posted by UnitUniverse on 1/13/2013 at 9:33 PM
@bubu
If you familiar with those librarys then you should have known many stuffs in those librarys use only the exceptions to identify false state of the call. For example, the vector::at(): it returns only a reference and accepts no argument, so the only way to report error at its caller is raising an exception. It's unreasonable to disable the exception for them. You may say 'well, then i will never touch any exception throwing stuffs in them after i disable the exceptions ...', but the truth is: There is no efficient way to disable the exception throwers without corrupting the function of any stuffs in those library.
Posted by Microsoft on 1/11/2013 at 10:51 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.