2008-12-18

STRUCT 키워드에서 :1 사용법


here is a little feature that allows you to save a little space.
main()   
{
     struct Flags
     {       
   unsigned int Online  :1;
          unsigned int Mounted :1;
     }
     struct Flags TapeInfo;
     TapeInfo.Online  = 1;
     TapeInfo.Mounted = 0;
}    

The :1 tells the compiler that only 1 byte is required for Online and Mounted. There are a few points to note about this though.


0 개의 댓글:

댓글 쓰기