title: Different ways of exiting a process in C++
body: <p>There are various ways of exiting a process:</p>
  
  <p>e.g.: ExitProcess, ExitThread (from the main thread), exit, abort, return from main, terminate.</p>
  
  <p>I'd like to know the effects each method has on static/global/automatic object destruction.</p>
  
  <p>For example, I have a project that crashes (probably due to some deallocation error) when ExitProcess is called, but not when exit() is called. (related to <a href="https://stackoverflow.com/questions/914613/what-exactly-is-the-effect-of-ctrl-c-on-c-win32-console-applications">this question</a>, incidentally). </p>
  
  <p>So basically I'd like to know under which circumstances deallocation of the above objects occurs, and in what order (For VC++).</p>