Boost logo

Boost :

Subject: [boost] [config] BOOST_NOEXCEPT on MSVC
From: Michael Marcin (mike.marcin_at_[hidden])
Date: 2013-03-31 01:11:39


Why isn't BOOST_NOEXCEPT defined to be throw() for msvc?

Microsoft Visual Studio 11.0\VC\include\yvals.h

defines:
#define _NOEXCEPT throw ()

and the rest of the standard library implementation uses it

ex.
void swap(thread& _Other) _NOEXCEPT
                { // swap with _Other
                _STD swap(_Thr, _Other._Thr);
                }

http://msdn.microsoft.com/en-us/library/wfa0edys.aspx states:

throw()
The function does not throw an exception. However, if an exception is
thrown out of a function marked throw(), the Visual C++ compiler will
not call unexpected (see unexpected (CRT) and unexpected (<exception>)
for more information). If a function is marked with throw(), the Visual
C++ compiler will assume that the function does not throw C++ exceptions
and generate code accordingly. Due to code optimizations that might be
performed by the C++ compiler (based on the assumption that the function
does not throw any C++ exceptions) if a function does throw an
exception, the program may not execute correctly.

It seems a better choice here than expanding BOOST_NOEXCEPT to nothing.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk