Question: Focusing on Visual C++, have you ever experienced significant performance gains in C++ code using `throw()` (i.e. `__declspec(nothrow)`) non-throwing specification?
Does it really help the optimizer?
Are there any benchmarks showing performance gains?

I found different (opposite) advice on the Internet:

[Boost exception-specification rationale](http://www.boost.org/development/requirements.html#Exception-specification) is *against* `throw()`, instead Larry Osterman seems to be *in favor* of it in his blog post: [Why add a throw() to your methods?](http://blogs.msdn.com/b/larryosterman/archive/2006/03/22/558390.aspx)

(I'd like to clarify that **I'm interested in VC++ specific code**; I know that in GCC the `throw()` specification can actually be a "pessimization" due to run-time checks.)

**P.S.** Reading ATL headers, I found that `throw()` is used pervasively; moreover, I found a convenient C++ RAII `unique_handle` class in [this MSDN article](http://msdn.microsoft.com/en-us/magazine/hh288076.aspx) that uses `throw()` specification as well.

Answer: 
The MSVC compiler treats it as an optimization hint, yes.

Boost has to be cross-platform, they have to go for something that's safe and efficient on a variety of compilers. And as the boost docs say, *some* compilers might generate slower code when `throw()` is specified, and in many cases, compilers can deduce that no exception is thrown *regardless* of whether there is a `throw()` specification, so for Boost, the safest approach is to just never use throw-specifications.

But if you're targeting MSVC specifically, then `throw()` effectively tells the compiler not to generate exception-handling code for the function, which may give a speedup in cases where the function was too complex for the compiler to determine that no exception could be thrown.
I add it, but its not to help the optimizer its to help me write more correct code.

```
class X
{
    public:
        void swap(X& rhs) throw(); // Swap better not ever throw
                                    // If it does there is something else
                                    // much more seriously wrong
};

```