title: Why EXC_BAD_ACCESS and not just an exception?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/12978234/how-to-prevent-crash-in-c">How to prevent crash in C++</a>  </p>
  </blockquote>
  
  
  
  <pre><code>typedef struct {
      int val;
  } valStruct;
  
  main()
  {
      try {
          valStruct *s = NULL;
          int v = s-&gt;val;       // bad 
      }
      catch (...) {}
  }
  </code></pre>
  
  <p>Fairly new to MacOS. Running under the debugger I get a EXC_BAD_ACCESS break. Not too hard to guess that it means a bad memory access occurred, but I do not get a C++ exception and in the code above my catch will not be invoked.</p>
  
  <p>This seems to be a bad thing, pretty much rendering C++ exception handling useless. Unless this is just a debug thing. If I run in release mode, or change settings, will this be handled as an exception?</p>