Partager via


Compiler Error C2822 (Windows Embedded CE 6.0)

1/5/2010

local unwind is not supported on this platform

The implementation of Structured Exception Handling on this platform does not support a local unwind operation, which is required when prematurely leaving either the guarded section or the termination handler of a try-finally statement. If you need to leave the guarded section, use the __leave keyword. Leaving the termination handler prematurely can have undefined behavior and should be avoided.

The following code demonstrates two ways this error message can be generated.

 
int g;
 
int main(void)
{
    __try {
        if (g) return g; // requires local unwind
        g = 1;
    } __finally {
        if (g) return g; // undefined; requires local unwind
        g = 2;
    }
 
    return 0;
}

See Also

Reference

Device Compiler Error Messages