title: Usage of Global variables in C++
body: <p>I am working on an application that reads files from an input directory,processes them and
      loads them on to DB. The two classes Filelist and CurrentFile are part of the application.
      The class defintions are as below.</p>
  
  <pre><code>class Filelist
  {
  
     //list of files
     list of files;
  
     // pointer to the current file
     CurrentFile *ptr
  };
  
  class CurrentFile
  {
  
     vector&lt;list of records&gt;
  
     methods to process the records
     ..
     ..
  };
  </code></pre>
  
  <p>I have to add another Audit structure that keeps track of successfully processed records and
  errored out records. This audit structure gets loaded into the DB after all the files are
  processed.</p>
  
  <pre><code>struct Recaudit
  {
       //record to keep track of
       //Various counts
       int successcnt;
       int errorcnt;
       billedcnt;
       some other counts related to the records
  };
  </code></pre>
  
  <p>This audit record has its data set across multiple methods of CurrentFile.</p>
  
  <p>Can this audit record be made a member variable of CurrentFile (or) should I declare it as a
  static global variable?</p>