다음을 통해 공유


PREfast Warning 243 (Windows CE 5.0)

Send Feedback

243 - Return from a finally-block halts global unwind.
Consequence: The exception will not be propagated.

This warning indicates that a return statement was detected in the handler of a try/finally statement.

A try/finally statement is intended to allow guaranteed cleanup, not exception handling, but returning from the finally block will handle an exception if one occurred.

Example

Defective Source

__try {
    ;
} __finally {
    if (rand()) {
        return 2;
    }
}

Corrected Source

int RetVal;

__try {
    ;
} __finally {
    if (rand()) {
        RetVal = 2;
    }
}

return RetVal;

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.