Partager via


PREfast Warning 242 (Windows CE 5.0)

Send Feedback

242 - A jump out of this try-block forces local unwind.
Consequence: Incurs severe performance penalty.

This warning indicates that a jump statement causes control-flow to leave the protected block of a try/finally statement other than by fall-through.

Leaving the protected block of a try/finally statement, other than by falling through from the last statement, requires local unwind to occur.

Performing a local unwind on processors such as MIPS, PPC, Alpha, and IA64 requires approximately 1,000 machine instructions, and is detrimental to performance.

Use _leave to exit the protected block of a try/finally statement.

Example

Defective Source

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

Corrected Source

int RetVal;

__try {
    if (rand()) {
        RetVal = 1;
        __leave;
    }
} __finally {
    ;
}

return RetVal;

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.