title: Why is using exit() considered bad?
body: <p>I'm reading <a href="https://stackoverflow.com/questions/1116493/how-to-quit-a-c-program">this question</a> and there is an answer that explains why using <code>exit()</code> is bad because:</p>
  
  <ul>
  <li>You will end up having multiple exit points from the program </li>
  <li>It makes code more convoluted (like using goto) </li>
  <li>It cannot release memory allocated at runtime</li>
  </ul>
  
  <p>I should clarify that I'm using Qt, so the code is already a bit "convoluted" since I'm taking advantage of signals and slots. That being said, for issue #1, I see it's related to #2, but my code currently attempts to avoid usage of <code>exit()</code> because I was told it would make my code look like a mess, but avoiding <code>exit</code> has made it a mess. I have functions that don't have to return anything, returning things. For example, when I have users register and their username already exists, instead of just calling <code>exit()</code> after telling the user registration has failed (which is the desired behavior in this situation) I return <code>false</code> to a function which then returns <code>false</code> to another function which then returns <code>false</code> to my main which then checks if that function returned true or false, and if it returns false then it returns 0. So much for avoiding <code>exit()</code> making the code clean.</p>
  
  <p>For the third issue, doesn't using <code>exit(0)</code> tell the OS that the program is done running and the OS will free that memory by itself anyway? I ran a test case that uses <code>exit(0)</code> when I press a button and the process is removed from the process list and the memory is freed, so why is this even a concern? It seems it's an outright false statement, at least on Windows.</p>