Skip to main content
Visitor II
April 17, 2007
Question

How to declare a bitfield without a name in a struct in Cosmic C?

  • April 17, 2007
  • 2 replies
  • 758 views
Posted on April 17, 2007 at 05:51

How to declare a bitfield without a name in a struct in Cosmic C?

    This topic has been closed for replies.

    2 replies

    davidsAuthor
    Visitor II
    April 15, 2007
    Posted on April 15, 2007 at 09:26

    On page 3-9 of the ''C Language manual Rev. 1.1'' it says:

    ''A bitfield without name will be used to skip the corresponding amount

    of bits in the allocation unit.''

    I'm not sure how to do that. Take this example, I want to define a char as bbbxxaaa where I don't care about xx and it should just be skipped (ie a bitfield without a name):

    struct {

    char a:3;

    char :2;

    char b:3;

    }

    Did I do that right?

    Thanks!

    -David

    Visitor II
    April 17, 2007
    Posted on April 17, 2007 at 05:51

    that's correct.

    Regards,

    Luca (Cosmic)