title: How to initialize a bit field in a constructor
body: <p>How do you initialize the values of the following struct in a constructor to defined values?</p>
  
  <p>Both options shown in my code example seem to be a bit ugly....</p>
  
  <pre><code>struct T_AnlagenInfo01
  {   
      // Option A
      T_AnlagenInfo01() : fReserve80_0(0), fReserve80_1(0),.... {}; 
  
      // Option B
      T_AnlagenInfo01()
      { 
          memset(this, 0, sizeof(T_AnlagenInfo01));
      } 
  
      unsigned long fReserve80_0                          : 1;        
      unsigned long fReserve80_1                          : 1;        
      unsigned long fReserve80_2                          : 1;        
      unsigned long fReserve80_3                          : 1;        
      unsigned long fReserve80_4                          : 1;
      unsigned long fReserve80_5                          : 1;
      unsigned long fReserve80_6                          : 1;
      unsigned long fReserve80_7                          : 1;
  
      unsigned long fReserve81_0                          : 1;        // 81   
      unsigned long fReserve81_1                          : 1;        
      unsigned long fReserve81_2                          : 1;        
      unsigned long fReserve81_3                          : 1;
      unsigned long fReserve81_4                          : 1;
      unsigned long fReserve81_5                          : 1;
      unsigned long fReserve81_6                          : 1;
      unsigned long fReserve81_7                          : 1;
  };
  </code></pre>