This documentation is archived and is not being maintained.


Microsoft Specific

nothrow is a __declspec extended attribute which can be used in the declaration of functions. This attribute tells the compiler that the declared function and the functions it calls never throw an exception. With the synchronous exception handling model, now the default, the compiler can eliminate the mechanics of tracking the lifetime of certain unwindable objects in such a function, and significantly reduce the code size.

return-type __declspec(nothrow) [call-convention] function-name ([argument-list])

Given the following preprocessor directive, the three function declarations below are equivalent:

#define WINAPI __declspec(nothrow) __stdcall 

void WINAPI f1();
void __declspec(nothrow) __stdcall f2();
void __stdcall f3() throw();

Using void declspec(nothrow) stdcall f2(); has the advantage that you can use an API definition, such as that illustrated by the #define statement, to easily specify nothrow on a set of functions. The third declaration, void stdcall f3() throw(); is the syntax defined by the C++ standard.

See Synchronous Exception Handling for more information.

END Microsoft Specific

See Also

__declspec | C++ Keywords