Thread: data structure element

  1. #1
    Registered User
    Join Date
    Mar 2010

    Smile data structure element

    I am working on a software project, I have the following data structure:

    struct saa7134_input {
    	char                    *name;
    	unsigned int            vmux;
    	enum saa7134_audio_in   amux;
    	unsigned int            gpio;
    	unsigned int            tv:1;
    My question is what tv:1 mean here?



  2. #2
    {Jaxom,Imriel,Liam}'s Dad Kennedy's Avatar
    Join Date
    Aug 2006
    Typically, when you'd see something like that is when you are attempting to "break out" a masked byte/short/int/etc. This means "give tv 1 bit in this structure". There is absolutely no advantage to doing this in this struct as the length of tv will still be four bytes on a 32-bit OS. Mainly you'd use this in conjunction with a union to be able to access all bits at once, as well as independently setting the bits -- Just use masks, that is so much easier.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling C in Visual Studio 2005
    By emanresu in forum C Programming
    Replies: 3
    Last Post: 11-16-2009, 04:25 AM
  2. Data structure for storing serial port data in firmware
    By james457 in forum C Programming
    Replies: 4
    Last Post: 06-15-2009, 09:28 AM
  3. xor linked list
    By adramalech in forum C Programming
    Replies: 23
    Last Post: 10-14-2008, 10:13 AM
  4. Replies: 4
    Last Post: 06-14-2005, 05:45 AM
  5. Request for comments
    By Prelude in forum A Brief History of
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM