title: __builtin_trap: when to use it?
body: <p>gcc provides additional builtin functions "for optimization".</p>
  
  <p>One of them is <code>void __builtin_trap (void)</code> which essentially is here to abort the program by executing an illegal command.</p>
  
  <p>From the doc:</p>
  
  <blockquote>
    <p>__builtin_trap function causes the program to exit abnormally. GCC implements this
    function by using a target-dependent mechanism (such as intentionally
    executing an illegal instruction) or by calling abort. The mechanism
    used may vary from release to release so you should not rely on any
    particular implementation.</p>
  </blockquote>
  
  <p>Why would you ever use this rather than <code>exit(1)</code> or <code>abort</code>? Why did the gcc developers see this as an optimization function?</p>