title: Detecting that the stack is full
body: <p>When writing C++ code I've learned that using the stack to store memory is a good idea. </p>
  
  <p>But recently I ran into a problem:</p>
  
  <p>I had an experiment that had code that looked like this:</p>
  
  <pre><code>void fun(const unsigned int N) {
      float data_1[N*N];
      float data_2[N*N];
  
      /* Do magic */
  }
  </code></pre>
  
  <p>The code exploted with a seqmentation fault at random, and I had no idea why.</p>
  
  <p>It turned out that problem was that I was trying to store things that were to big on my stack, is there a way of detecting this? Or at least detecting that it has gone wrong?</p>