다음을 통해 공유


noreturn (Windows CE 5.0)

Send Feedback

This __declspec extended storage-class modifier tells the compiler that a function does not return, and prevents the compiler from generating a warning message or error message about the function return. As a consequence, the compiler knows that the code following a call to a __declspec(noreturn) function is unreachable.

If the compiler finds a function with a control path that does not return a value, it generates a warning (C4715) or error message (C2202). If the control path cannot be reached due to a function that never returns, you can use __declspec(noreturn) to prevent this.

Consider the following code. The else clause does not contain a return statement, so the programmer declares __declspec(noreturn) as fatal to avoid an error or warning message.

__declspec(noreturn) extern void fatal ()
{
   // Code omitted
}

int gloo()
{
   if(...)
    return 1;
   else if(...)
    return 0;
   else
    fatal();
}

See Also

__declspec

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.