title: global variable for the main class of the app
body: <p><a href="https://github.com/mumble-voip/mumble/blob/master/src/mumble/Global.h" rel="nofollow">https://github.com/mumble-voip/mumble/blob/master/src/mumble/Global.h</a></p>
  
  <pre><code>#define g (*Global::g_global_struct)
  </code></pre>
  
  <p>Is this design one I could use? In mumble source, there's a global variable (a single one) <code>g</code> that is an instance of the main class of the app that encapsulates everything.</p>
  
  <p>Is this case where <code>global variables are evil</code> doesn't apply? having a single global variable for the whole app like that?</p>
  
  <p>In my case, I don't have any globals. However, my <code>main</code> app class, is used everywhere obviously and I'm currently using "Dependency Injection" but it doensn't seem feel right in my case. I could just have a <code>extern class gApp</code> in my header and include it everywhere.</p>