what does the ":" do in this code...

This is a discussion on what does the ":" do in this code... within the C++ Programming forums, part of the General Programming Boards category; what does the ":" do in this code... Code: union aword { DWORD dword; BYTE byte [4]; struct { unsigned ...

  1. #1
    Unregistered
    Guest

    Exclamation what does the ":" do in this code...

    what does the ":" do in this code...
    Code:
    	union aword {
    	  DWORD dword;
    	  BYTE byte [4];
    	  struct {
    	    unsigned int byte3:8;
    	    unsigned int byte2:8;
    	    unsigned int byte1:8;
    	    unsigned int byte0:8;
    	  } w;
    	};

  2. #2
    zen
    zen is offline
    of Zen Hall zen's Avatar
    Join Date
    Aug 2001
    Posts
    1,007
    It sets the size of the field (variable) in bits. So each of the unsigned ints will use 8 bits to represent its value.
    zen

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Enforcing Machine Code Restrictions?
    By SMurf in forum Tech Board
    Replies: 21
    Last Post: 03-30-2009, 07:34 AM
  2. signify?? -- "\" One line Code
    By indrajit_muk in forum C Programming
    Replies: 3
    Last Post: 11-22-2008, 12:00 PM
  3. Values changing without reason?
    By subtled in forum C Programming
    Replies: 2
    Last Post: 04-19-2007, 10:20 AM
  4. Obfuscated Code Contest
    By Stack Overflow in forum Contests Board
    Replies: 51
    Last Post: 01-21-2005, 03:17 PM
  5. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21