NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Compiler Error C2707

'identifier' : bad context for intrinsic function

Structured exception-handling intrinsics are invalid in certain contexts:

To resolve the error, be sure that the exception-handling intrinsics are placed in the appropriate context. The following sample generates C2707:

#include <windows.h>

LONG MyFilter() {
   int x, y;

   return(GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION ?   // C2707
   EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH);

   __try {
      y = 0;
      x = 4 / y;
      return 0;
   }

   __except(MyFilter()) {
      return(GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION ?   // ok
      EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH);
   }
}

void main() {
}