title: Handling access violation in applications
body: <p>My x64 application is compiled with /EHa, </p>
  
  <p>I want to guard my code against access violations, but the application process seems to crash regardless of my SEH and termination handlers.</p>
  
  <pre><code>void my_se_translator(unsigned int, struct _EXCEPTION_POINTERS*) {
      cout &lt;&lt; "se_translator_called" &lt;&lt; endl;
  }
  
  void my_terminate_handler() {
      cout &lt;&lt; "my_terminate_handler_called" &lt;&lt; endl;
  }
  
  #pragma optimize("", off)
  void test() {
  
      int* k = nullptr;
      int z = *k;
  }
  #pragma optimize("", on)
  
  int main(int argc, char* argv[]) {
  
      _set_se_translator(my_se_translator);
      set_terminate(my_terminate_handler);
  
      test();
  
      return 0;
  }
  </code></pre>
  
  <p>Would appreciate a good explanation for why _set_se_translator does not work in this case?</p>