Bitfields

Using bitfields to save memory may be a bad idea as bitfields produce a lot of additional code. For ANSI-C compliance, bitfields have a type of signed int, thus a bitfield of size 1 is either -1 or 0. This could force the compiler to sign extend operations:

  struct {
  
  
    int b:0; /* -1 or 0 */
  
  
  } B;
  
  
  int i = B.b; /* load the bit, sign extend it to -1 or 0 */
  
  

Sign extensions are normally time- and code-inefficient operations.